8
votes
How to gzip logs created by rotatelogs
You could use rotatelogs option -p to use a program to compress the log after the rotation. (See for reference: https://httpd.apache.org/docs/2.4/programs/rotatelogs.html)
-p program
If given, ...
5
votes
Accepted
Name rotated auditd logs with date
auditd can't do this. Its built in log rotation works by size, not by date.
You should be able to turn off auditd's built in log rotation, and then configure logrotate to rotate its logs. It does ...
4
votes
Accepted
Log Rotate doesn't rotate logs
The problem is with PATH in cron session.
/bin/sh: 1: logrotate: not found
You can fix with full path of command:
*/2 * * * * root /usr/sbin/logrotate /etc/logrotate.d/rotate_tomcat >> /var/...
3
votes
Accepted
NGINX and log rotation: is missing log entries possible?
Before send USR1 signal wait for 15 seconds and you will see that *access.log.0" is still being used. It happens because log is open for write access based on inode, not the file name. So it is ...
3
votes
How do I allow apache to rotate logs in user home directory with SELinux enabled?
Couldn't add a comment in the excellent answer above so I'll have to add a new "answer":
If you can't compile the freshly made module because of a missing /usr/share/selinux/devel/Makefile file, make ...
2
votes
Syslog logging to syslog.1 not syslog
Put this line:
invoke-rc.d rsyslog rotate > /dev/null
instead of:
reload rsyslog >/dev/null 2>&1 || true
It will cause rsyslog to properly reload, close rotated files and new open log ...
2
votes
Accepted
What is rotating my mail logs
It's logrotate(8).
In /etc/crontab, this line:
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
...uses run-parts(8) to run all the scripts in /...
2
votes
Accepted
Ideal log rotation configuration for overloaded site
EEAA's advice to use a remote log server addresses the problem completely, but may not be possible in your environment.
Use LogRotate to reload Apache rather than restarting it, as described on this ...
2
votes
where is rotation policy of logs under /var/log/messages-*
Just type
sudo grep messages /etc/logrotate.d/*
On my system this returns
/etc/logrotate.d/rsyslog:/var/log/messages
2
votes
Accepted
What does the --force flag change about the behaviour of logrotate?
Whenever logrotate is determining whether a given file needs to be rotated, the --force flag makes it answer unconditionally "yes, this file is in need of rotating". It simply makes logrotate ...
2
votes
Logrotate is not working centos 6.6
rotate 0
from the man page
rotate count
Log files are rotated count times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed ...
2
votes
Accepted
How to move compressed files with logrotate
Try lastaction/endscript
From the man page:
The lines between lastaction and endscript (both of which must appear on lines by themselves) are executed (using /bin/sh) once after all log files that ...
2
votes
Is logrotate supposed to work only in logs inside /var/log?
logrotate works on any directory you configure, not only /var/logs
your configuration is missing the period when rotation should happen (daily, weekly, ...)
on Ubuntu, logrotate job is triggered by ...
2
votes
Is logrotate supposed to work only in logs inside /var/log?
If it performs the rotation with --force, then that implies that your configuration is fine, but logrotate does not believe that the file needs to be rotated at this time.
You can run logrotate -v /...
1
vote
Accepted
Where can I find older wtmp log files?
On most Linux distributions logrotate only keeps one older version of /var/log/wtmp. If you need more, you can configure it typically in a place like /etc/logrotate.d/wtmp. Look for a line saying
...
1
vote
Accepted
How to configure log rotate to compress and archive logs weekly
You could write a single configuration file with different stanzas, one for each file to be rotated and use the directives dateext, dateformat, olddir, but be carefull with olddir (your /mnt dir ...
1
vote
The logrotate 'rotate' directive and migrating from daily to weekly
If you change the number of logs, then at the next run logrotate will ensure that at most that many logs are kept. The number is not necessarily related to number of days (you could run logrotate ...
1
vote
logrotate status files extremely large
Deleting or rotating the logrotate.status file is only a band-aid. You need to take a step backward and ask the question, "why is the logrotate.status file that large?"
I would tail -n 500 that ...
1
vote
Logrotate with `copytruncate` "data loss" - is it serious?
It all depends on your requirements how much inaccuracy you can take because of it. To find out exactly how much effect it has, you have to test your use case.
There are so many things depending on ...
1
vote
Ideal log rotation configuration for overloaded site
It's possible to rotate the logs without restarting or reloading apache at all. The downside is that you risk losing some log entries.
Here are two ways of doing that:
set up a separate log server ...
1
vote
Apache log4j cloudstack log rotation archival policy
For a start there is no 'rolling' package in the log4j 1.2 (which i know you are using;) ). Referring to a class in a package which is non existent may result in 'ClassNotFound Exceptions' because the ...
1
vote
logrotate when size reaches 10M
You need to configure running logrotate in such intervals that the size of your log file has exceeded 10 megabytes.
For example, if your log file gets 10M of data in ten minutes, then you need to run ...
1
vote
Logrotate failing with `No data available` error
I didn't have enough disk space for log rotation to actually create all the rotated log files dictated by my .conf file. I truncated the log file, tried again, and it worked.
1
vote
Accepted
MongoDB Oplog Security
Sensitive data in logs is the same as sensitive data anywhere. Depending on the criticality you'll want to -
only allow those authorized to view it to have access to the data (usually done via roles ...
1
vote
How to gzip logs created by rotatelogs
CustomLog "|/opt/IHS/bin/rotatelogs -l /some/path/access_log.%Y.%m.%d 86400" common | gzip -9 /some/path/access_log.`date '+%Y.%m.%d'`
1
vote
How to gzip logs created by rotatelogs
I use find and crontab to accomplish this
# crontab -e
5 0 * * * /bin/find /path/to/logs/* -type f \( -mtime 1 ! -name "." ! -name ".gz" \) -print0 | xargs -0 gzip >/dev/null 2>&1;
-mtime n ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
log-rotation × 65logrotate × 37
logging × 25
linux × 15
log-files × 8
apache-2.2 × 6
centos × 6
nginx × 5
ubuntu × 5
rsyslog × 4
bash × 3
cron × 3
ubuntu-14.04 × 3
windows × 2
apache-2.4 × 2
docker × 2
syslog × 2
gzip × 2
mysql × 1
security × 1
backup × 1
performance × 1
configuration × 1
unix × 1
vps × 1