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 
425 questions
82
votes
3 answers

logrotating files in a directories and its subdirectories

Is it possible to get logrotate to consider logfiles in a directory and all its subdirectories? (i.e. without explicitly listing the subdirectories.)
ithinkihaveacat
  • 1,604
  • 3
  • 14
  • 18
71
votes
5 answers

How can I monitor what logrotate is doing?

How can I monitor what logrotate is doing in Ubuntu? Can the activity of logrotate be monitored?
user56548
59
votes
5 answers

Equivalent of logrotate on OSX

Is logrotate hiding somewhere on OSX, or is there an equivalent? It's not in /usr/sbin.
Steve Bennett
  • 5,539
  • 12
  • 45
  • 57
56
votes
4 answers

logrotate daily and size?

If a logrotate config is specified with "size" and "daily" parameters, which one takes precedence? Where is this documented? I would like these rotations to occur as a boolean OR operation, ie, if the logs are a day old they get rotated, OR if they…
cat pants
  • 2,139
  • 10
  • 33
  • 44
49
votes
4 answers

When to use delaycompress option in logrotate?

The man page of logrotate says that: It can be used when some program cannot be told to close its logfile and thus might continue writing to the previous log file for some time. I'm confused by this. If a program cannot be told to close its…
Anand Chitipothu
  • 593
  • 1
  • 4
  • 5
46
votes
6 answers

Where does logrotate save its own log?

I have logrotate running in an EC2 AWS machine rotating Apache logs. Once packed, Apache logs are saved into AWS S3 via s3fs. The problem is that I recently noticed that I didn't have logs rotated. In S3 I have old logs from day 48->60 but the 1->47…
enedebe
  • 1,006
  • 3
  • 11
  • 17
37
votes
3 answers

How does logrotate exactly handle "daily"?

Judging by the timestamps on my systems, logrotate does its daily log rotation when logrotate is run by cron. However, if I run it earlier than that it doesn't rotate the files. How does logrotate know if should rotate them or not, does it keep a…
Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
35
votes
5 answers

logrotate not rotating the logs

I have this logrotate config and I am running on Ubuntu 10.04. /var/log/mysql/mysql-slow.log { daily rotate 3 compress notifempty missingok create 660 mysql adm postrotate if test -x /usr/bin/mysqladmin && \ …
Carmen
  • 807
  • 3
  • 11
  • 13
34
votes
3 answers

Equivalent of LogRotate for Windows?

We have a huge logfile being written by a vendor's application. Let's assume the vendor won't do anything that we ask. Is there any way of rotating that logfile? We're looking at about 300 MB an hour being written - I'd much rather chunk that into…
mfinni
  • 35,711
  • 3
  • 50
  • 86
27
votes
3 answers

How i configure logrotate to not delete my log files after rotation?

There's a way to do this?
Guilherme
  • 711
  • 2
  • 7
  • 8
26
votes
5 answers

Preferred format of file names which include a timestamp

As we all know "unix" can have anything in a file except '/' and '\0', sysadmins however tend to have a much smaller preference, mainly due to nothing liking spaces as input ... and a bunch of things having a special meaning for ':' and '@' among…
James Antill
  • 731
  • 1
  • 5
  • 10
23
votes
5 answers

rsyslog with logrotate: reload rsyslog vs copytruncate

I'm working on Ubuntu 14 with the default rsyslog and logrotate utility. In the default rsyslog logrotate /etc/logrotate.d/rsyslog config I see the following: /var/log/syslog { rotate 7 daily missingok notifempty …
Mattan
  • 333
  • 1
  • 2
  • 5
23
votes
3 answers

nginx logging to access.log.1 instead of access.log, logrotate failing?

I have an nginx instance that is set to log access to /var/log/nginx/access.log and errors to /var/log/nginx/errors.log, but as soon as logrotate runs each week, the file gets moves to *.log.1 and the new *.log file gets created, but nginx continues…
Ben Torell
  • 805
  • 1
  • 6
  • 11
23
votes
3 answers

Logrotate and Open Files

How does logrotate handle open files? Can logrotate rotate files that a process has open?
Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
23
votes
7 answers

Continuously monitor logs with tail that are occasionally rotated

We're using tail to continuously monitor several logs, but when a log is rotated the tail for that file will cease. As far as I understand, the problem is that when the log is rotated, there is a new file created, and the running tail process…
xkcd150
  • 908
  • 1
  • 7
  • 11
1
2 3
28 29