Questions tagged [logrotate]

logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.

logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.

Normally, logrotate is run as a daily cron job. It will not modify a log multiple times in one day unless the criterium for that log is based on the log’s size and logrotate is being run multiple times each day, or unless the -f or -force option is used.

Any number of config files may be given on the command line. Later con- fig files may override the options given in earlier files, so the order in which the logrotate config files are listed in is important. Nor- mally, a single config file which includes any other config files which are needed should be used. See below for more information on how to use the include directive to accomplish this. If a directory is given on the command line, every file in that directory is used as a config file.

If no command line arguments are given, logrotate will print version and copyright information, along with a short usage summary. If any errors occur while rotating logs, logrotate will exit with non-zero status.

AUTHORS

   Erik Troan 
   Preston Brown 
436 questions
5
votes
2 answers

How does one manually rotate log without logrotate on open/live file?

My Google-Fu is getting me so close but just not quite there, and I guess I'm too green in Linux to put the pieces together. I have a very large >200GB log file, still being written to. Logrotate wont get to it in time before disk space could be a…
Ceafin
  • 61
  • 1
  • 3
5
votes
1 answer

Cron daemon reporting "unknown user 'tomcat6'" every day since I removed tomcat

I'm running Ubuntu 12.04. Since I removed tomcat via aptitude purge the other day, I keep getting the following error from Cron daily: /etc/cron.daily/logrotate: error: tomcat6:7 unknown user 'tomcat6' error: found error in…
theV0ID
  • 153
  • 4
5
votes
2 answers

Logrotate error for fail2ban

I get the following error when running a cron job, and I'm not too sure how to go about fixing. This is on Ubuntu 12.04 LTS. test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) /etc/cron.daily/logrotate: error: error running…
Errol Fitzgerald
  • 475
  • 1
  • 8
  • 17
5
votes
5 answers

How to concat rotated logs back together

How to concatenate the rotated logs back together to make the original file? huali-access.log huali-access.log.15 huali-access.log.21 huali-access.log.28 huali-access.log.34 huali-access.log.40 huali-access.log.47 …
steveyang
  • 673
  • 4
  • 10
  • 16
5
votes
2 answers

PHP-FPM signals for pool error_log rotation

I am moving all my server's log rotation tasks for logrotate. The server has several PHP-FPM pools, each of them configured with a separated error_log directive. The logrotate recipe for the logs is fairly simple: /var/log/php/*.log { rotate…
Ville Mattila
  • 459
  • 7
  • 13
5
votes
2 answers

logrotate is not executing custom shell script in postrotate

I have following logrotate configuration file /home/application/*/shared/log/*.log { daily rotate 10 missingok nocompress notifempty copytruncate sharedscripts postrotate echo "Hi....." /home/application/test.sh >…
user1124133
  • 169
  • 1
  • 3
  • 8
5
votes
5 answers

How should I deal with logs before they get to big?

I found out my disk was full today, and I freed up 10% just from deleting mostly logs from multiple websites. I, personally, like to keep logs as an archive, because I may need to look back on them for whatever reason. I'm new to administrating my…
Strawberry
  • 1,132
  • 4
  • 15
  • 27
5
votes
1 answer

I want my logs sent to my mail with logrotate

Not strictly a question about programming as such, more of a log handling question. Anyway. My company has multiple clients, and each of these clients have a set of logs that I'd rather much want to get sent to by e-mail to me. Now, another…
lericson
  • 161
  • 1
  • 4
5
votes
4 answers

Daily Weekly and Monthly DB backup with logrotate?

I am currently keeping daily backup of my database by doing a daily mysqldump and by using logrotate to keep the 7 last days of mysqldump. I would like to improve this backup process to keep 7 daily backup, 3 weekly backups and 12 monthly backup. I…
benjisail
  • 1,331
  • 5
  • 19
  • 32
4
votes
1 answer

Logcheck Ignore Logrotate

I inherited a system using both logcheck and logrotate. The issue I'm having is that logrotate is sending a nasty e-mail saying something along the lines of: *** WARNING ***: Log file (X) is smaller than last time checked! Whenever logrotate…
Dylan Brams
  • 143
  • 5
4
votes
1 answer

Configuring NGINX for GDPR (= RGPD, DSGVO) compliance using anonymized IPs on older log files

The European General Data Protection Regulation Law (GDPR) aims to protect end users privacy. Among many other consequences, system administrators are therefore obliged to configure their systems in a way that they do not store IP addresses for…
Mischa
  • 183
  • 8
4
votes
3 answers

How to combine logrotate with Log4j "rolling" file-appender?

We have a Java-application, that uses log4j and rotates its own logs daily: The currently-used log-file is /var/log/foo/foo.log It is moved into /var/log/foo/foo.log.YYYY-MM-dd when the day changes We'd rather not change its…
Mikhail T.
  • 2,338
  • 1
  • 24
  • 55
4
votes
2 answers

logrotate not writing logs to correct file

I have a production system on which there are multiple nginx apps hosted. those are nginx applications servers. Now for each of these nginx app servers a logrotate config file is configured in /etc/logrotate.d/ folder. one of the example of…
Shailesh Sutar
  • 1,517
  • 5
  • 23
  • 41
4
votes
2 answers

Why auth.log gets rotated multiple times every day?

I noticed a suspicious behaviour of my auth.log. For some reason it is getting rotated multiple times everytime it should rotate. 2014-06-15 06:25:06,102 fail2ban.filter : INFO Log rotation detected for /var/log/auth.log 2014-06-15 06:25:06,102…
Möhre
  • 229
  • 1
  • 11
4
votes
1 answer

Rotate haproxy logs

I tried few things but still not able to rotate haproxy logs efficiently. I need to rotate logs when log files crosses 500 MB size. Considering haproxy is serving large no. of static tcp connections, I can not restart haproxy process though a reload…
Jagbir
  • 157
  • 1
  • 2
  • 7