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
7
votes
1 answer

How does logrotate handle concurrency?

In the case that logrotate runs the same time as the log file is being updated, what will happen? Will the new log be rotated into a historical log file? Or it will stay in the current log file?
johnsam
  • 235
  • 1
  • 6
7
votes
2 answers

Logrotate Creating Empty Rotated Files

I have the following parameters set up for the log rotation of a log. size=10M, rotate 800, copytruncate, missingok. 800 rotated files are being created, but many of them are below 10M and some of them are empty with 0 size. I have a cron setup as *…
NixMan
  • 191
  • 1
  • 1
  • 5
7
votes
3 answers

logrotate rename files with date

Right now, logrotate renames old log files to access.log.1.gz, access.log.2.gz, etc. I would prefer if it named them access.log.20090714.gz, access.log.20090715.gz, etc - one for each day. I cannot find any option of specifying a filename pattern…
Krystian Cybulski
  • 495
  • 3
  • 6
  • 13
7
votes
2 answers

rotate nohup out file (nohup.log)

is there a 'native' way where i can rotate nohup out file ?
silviud
  • 2,687
  • 2
  • 18
  • 19
6
votes
1 answer

Using logrotate to only compress and delete old files without rotating

I want to compress some log files which have name format as abc.log.yyyy-MM-dd and then delete the compressed log file (abc.log.yyyy-MM-dd.gz) after x days.I don't want logrotate to rotate files(i.e. create new files), I only want it to compress and…
Chaitali
  • 61
  • 1
  • 3
6
votes
1 answer

How do you rotate apache logs on windows without interrupting service?

I administrate a Windows Server 2003 (Standard Edition, 32-bit) installation running Apache2 and ColdFusion. The server has over 100 virtual hosts, each with an access log and an error log. I've been looking for an analog to (or a win32 port of)…
Joe
  • 1,775
  • 15
  • 23
6
votes
2 answers

Logrotate not rotating

I have set new conf for logrotate, but I just couldn't get it working. Here's my logrotate: /home/deployer/abc/shared/log/*.log { daily missingok rotate 30 compress delaycompress size 5M copytruncate } Here's what I have…
Victor
  • 261
  • 1
  • 2
  • 10
6
votes
2 answers

Error with gunzip during logrotate

I'm using logrotate to rotate my Symfony2 logs on my webserver. Everything works fine, but I wanted the old logs to be sent to me by emails. So, I added some line in my logrotate conf file as you can see below Logrotate…
6
votes
3 answers

How does logrotate interact with hard linked files?

I have a service which insists on keeping it's log files in terrible locations. After all efforts to change where it keeps them failed, my next idea was to create hardlinks to those files somewhere cleaner. This led me to a concern: If I configure…
Scivitri
  • 171
  • 1
  • 4
6
votes
2 answers

Logrotation - postrotate firing too soon?

I have a configuration file that looks like: /var/log/nginx/*.log { daily missingok rotate 90 dateext compress notifempty create 644 root adm sharedscripts postrotate …
Will
  • 826
  • 2
  • 9
  • 19
6
votes
4 answers

Is there any alternate to logrotate for apache logs?

I need an alternate for rotating logs on my server, everytime logrotate runs apache goes down for like 10-20 minutes, i'm not sure if this is right, but don't seem right for me. Is there any alternate for logrotate on apache? That long time to…
Rod
  • 371
  • 4
  • 10
5
votes
4 answers

Exclude files / dirs logrotate

I am logging all our applications logs to /logs/, where all our applications have an seperate directory. I have made a custom logrotate file as follows: /logs/*.log { daily missingok rotate 1 sharedscripts dateext } So this is…
Tom
  • 63
  • 1
  • 1
  • 4
5
votes
1 answer

logrotate: What means the message "log has been already rotated"

If I run logrotate I get log does not need rotating (log has been already rotated) and the log file is not rotated. Why that? My log rotate conf: /var/log/capp/*.log { missingok rotate 90 daily notifempty compress …
Steffen
  • 989
  • 3
  • 13
  • 31
5
votes
0 answers

logrotate as non-root user for files with various owners

I have a collection of log files with various owners. Each log file corresponds to one of a suite of programs, and the permissions are group writable so that whoever starts the program(s) can write to the logs. (Files are 660, directories are…
craq
  • 231
  • 3
  • 8
5
votes
1 answer

Unable to enable custom SELinux rule

logrotate is unable to rotate a log file for our application on CentOS 7. This appears to be because of this AVC error: type=AVC msg=audit(1441112694.305:19502): avc: denied { write } for pid=9146 comm="logrotate" name="autuitive.log" dev="xvda1"…
Soviero
  • 4,366
  • 8
  • 36
  • 60