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
3
votes
2 answers

systemd, logrotate and PID-files

I'm packaging some daemon for debian 8 and systemd. The daemon can create PID-file by itself, but it has no permissions to write into /run because of non-root user. It used to create PID-file via old sysV init-script, but it doesn't work on…
Paul K.
  • 125
  • 1
  • 1
  • 9
3
votes
2 answers

Daily logrotate error creating unique temp file: Permission denied

I have a CentOS 6.7 box that for some reason fails to rotate logs daily. I'm getting an e-mail similar to this one every day in /var/mail/root: To: root@server.nl Content-Type: text/plain; charset="ANSI_X3.4-1968" Subject: Anacron job 'cron.daily'…
Rafe
  • 135
  • 1
  • 6
3
votes
1 answer

logrotate frequency - when and from when

if have lograte in my daily cron /etc/cron.daily/logrotate -- assume cron.daily is run at 1.05am daily and if my logrotate config has a weekly settings Does it means that my logrotate will run daily, but the logs will only be rotated weekly…
tiongmaru
  • 355
  • 1
  • 5
  • 11
3
votes
1 answer

SELinux allow access for perl script via log rotate

I have a perl script that I want to run as a perorate script for log rotate. When I force log rotate to run from the command line as root, it works. However, when run through cron, SELinux prevents operation. I don't remember what the first error…
ibrewster
  • 387
  • 1
  • 4
  • 16
3
votes
3 answers

logrotate causes php5-fpm downtime

I've noticed that one of our servers starts returning errors just after logrotate runs, i.e. in nginx error log I can see: [error] 8501#0: *118126869 recv() failed (104: Connection reset by peer) while reading response header from upstream,…
Kasia Gogolek
  • 155
  • 1
  • 7
3
votes
1 answer

logrotate compression parameters

I've been using cstream for a while for many things, for example to reduce the impact that mysqldump has on drives. However, I have always done so by calling the binary directly from a script or cronjob. I've got one situation now in which it would…
john fish
  • 61
  • 1
  • 3
3
votes
1 answer

Syslog logging to syslog.1 not syslog

My syslog file is getting a bit unmanageable. I believed I had configured this previously to rotate daily but obviously something has gone amiss. At the moment, my /var/log looks like this: -rw-r----- 1 syslog adm 0 Feb 25 06:25…
Zakalwe
  • 153
  • 2
  • 7
3
votes
1 answer

Using logrotate to ONLY delete logs that are managed/rotated by another service

There are many programs out there that manage log file rotation by themselves. Many of them however only rotate the log and never delete them, and assume that is just part of the sysadmin's job and he/she will backup or delete as necessary. My…
bwest05dm
  • 31
  • 1
  • 4
3
votes
1 answer

Rotate log files with timestamp in file name

I have a log directory that my app writes into. It creates a log file like this: 2015-01-22-10-full-activity.log 2015-01-22-11-full-activity.log 2015-01-22-12-full-activity.log 2015-01-22-13-full-activity.log I want to compress every file except…
johnwards
  • 765
  • 1
  • 9
  • 13
3
votes
2 answers

Script to modify logrotate configuration files?

I'm looking for a script that will allow me to programatically modify logrotate configuration files. At the least I'd like it to be able to replace a block such as /var/log/wtmp { missingok monthly create 0664 root utmp rotate…
Michael Kohne
  • 2,334
  • 1
  • 16
  • 29
3
votes
2 answers

logrotate not emailing log

My logs are being rotated properly, however, I am not being emailed the rotated log. What am I doing wrong? My main logrotate.conf is: include /etc/logrotate.d here is my /etc/logrotate.d/php-errors: /var/log/php-errors.log { rotate 7 …
smusumeche
  • 643
  • 4
  • 8
  • 19
3
votes
1 answer

Making logrotate remove old logs after reducing 'rotate' value

I'm trying to reduce the number of log files kept for Apache by reducing 'rotate 52' in /etc/logrotate.d/apache2 to 'rotate 8'. With weekly rotation this should keep 2 months of logs instead of a full year. I deployed the new configuration via…
Martijn Heemels
  • 7,728
  • 7
  • 40
  • 64
3
votes
4 answers

Logrotate appends "1" at the end of compressed file name

I have a script which runs as a cronjob every 30 mins and takes mysqldump of some tables. The dump files are stored in /var/log/…
reflektor
  • 33
  • 1
  • 3
3
votes
2 answers

How to use wildcards within logrotate configuration files

I have the following configuration that is not working: 1) Using rsyslog with Centos 5. 2) Inside /etc/logrotate.d I have the file sj-piers-logs. SJ-PIERS-LOGS: /syslogrep/sjpiers-logs/0*…
3D1L
  • 109
  • 3
  • 7
  • 13
3
votes
2 answers

make logrotate to only rotate at service startup

I'd like to do logfile rotation for whenever i start a service, but never "automatically". I'm running a python-based service that logs to a specific logfile. the service (currently) does not support notification to re-open it's logfiles (e.g. USR1…
umläute
  • 499
  • 1
  • 7
  • 26