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

Can postgres internal log rotation mechanism delete log files older than a certain time?

I am using posgtres' internal log rotation mechanism. I would like log files older than 30 days to be deleted. How do I get postgres to do this? If postgres does not support it, can I set logrotate to just delete logs older than 30 days? My current…
Freiheit
  • 201
  • 1
  • 2
  • 15
10
votes
3 answers

NginX Log Rotation

I am serving a couple different domains through NginX on the same server and they each log to their own file. I need to set up a script to rotate, and compress these files and add it to cron. I know I have to do something to get NginX to open a…
John F. Miller
  • 201
  • 1
  • 2
  • 6
10
votes
6 answers

How to compress and clean logs with logrotate but not rotate them

I have a Tomcat server which create access logs via a valve (org.apache.catalina.valves.FastCommonAccessLogValve). This valve takes care of rotating the access log file, but not of compressing them or deleting them after some time. For the moment,…
Guillaume
  • 1,063
  • 5
  • 12
  • 24
10
votes
2 answers

Apache2 and logrotate: delaycompress needed?

I am currently looking at the file size of my Apache logs as they became huge. In my logrotate configuration, I have delaycompress enabled. Does Apache really need this (as the logrotate documentation says that some programs still write in the old…
j0nes
  • 955
  • 1
  • 12
  • 27
9
votes
2 answers

Rsyslog stops sending data to remote server after log rotation

In my configuration, I have rsyslog who is in charge of following changes of /home/user/my_app/shared/log/unicorn.stderr.log using imfile. The content is sent to another remote logging server using TCP. When the log file rotates, rsyslog stops…
Vincent B.
  • 271
  • 1
  • 2
  • 8
9
votes
4 answers

log rotation --Windows

I am looking into log rotation for our web server (not apache) on Windows. I have heard of cronolog, CHOMP, and others. Does Windows have a built-in rotation .exe? What have you found to be a good logrotation application?
skitterm
  • 91
  • 1
  • 1
  • 2
9
votes
4 answers

Free-space driven log rotation on linux?

Someone just asked me 'how long should we keep logs for our application', and my answer was 'until the disk is full' as there's no reason to throw them away other than running out of space. However, standard logrotate wants us to specify a specific…
kdt
  • 1,400
  • 3
  • 22
  • 34
9
votes
2 answers

apache restarted/reloaded config by itself automatically, why?

in short: running production webserver tuesday: changed config (the change was erroneous, wrong syntax) but deliberately not restarted apache apache restarted or reloaded config by itself today @cron.daily time apache was down why apache restarted…
c33s
  • 1,515
  • 3
  • 21
  • 39
9
votes
4 answers

Rotate logs of a dumb non-interactive application

Ubuntu 10.4 Server. I have a dumb non-interactive legacy service which is running constantly on my server. It is writing its log to a file with fixed name (/var/log/something.log). It does not handle any signals to let go of the log file. I need to…
Alexander Gladysh
  • 2,423
  • 8
  • 31
  • 49
8
votes
3 answers

Logrotate creates long names and does not delete logs

postgres_db_dump_20091016.gz.1.1.1.1.1.1.1.1.1.1.1-20091021-20091021-20091021-20091021-20091021-20091021-20091021-20091021-20091021-20091021 postgres_db_dump_20091017.gz.1.1.1.1.1.1.1.1.1.1.1-20091021-20091021-20091021-20091021-20091021-20091021-2009…
iElectric
  • 358
  • 1
  • 5
  • 14
8
votes
2 answers

How can I get logrotate dateext to reflect the log date rather than the rotation date?

My Apache logrotate config looks like this: /var/log/http/*log { monthly dateext dateformat .%Y.%m [... rest stripped for brevity ...] } This works great, except that the date on the rotated filename is one period later than the…
Adam
  • 361
  • 1
  • 3
  • 9
8
votes
3 answers

How can I specify multiple rules for a particular log file(s) with logrotate?

I have a logrotate.d config file that looks something like this: /home/myapp/log/* { daily compress dateext ifempty delaycompress olddir /home/myapp/baklog } There are a few particular log files where I want to apply…
Ether
  • 322
  • 3
  • 12
7
votes
0 answers

Logrotate and "insecure permissions": What can actually go wrong?

Logrotate complained to me this morning that it would not rotate some logs because their parent directory is writeable by someone else than root. The man page states I can make the error message go away by adding the "su" directive which makes…
Simon
  • 255
  • 2
  • 7
7
votes
5 answers

How to exclude a service under /etc/logrotate.d/ to run with the main logrotate job

I have a file under logrotate.d that I would like not to run when the main logrotate is running. I have created a separate job for this in /etc/crontab 45 23 * * * root mv /var/log/RemoteSystems/*/*.log /var/log/Archiv/ && logrotate…
Ioan
  • 71
  • 1
  • 3
7
votes
3 answers

Why do JBoss and Logrotate create log files full of NUL characters?

I've set up Logrotate to rotate my JBoss Application Server 4.2.2.GA logs nightly. After the log files have been rotated and JBoss starts writing to them again, the new log files begin with as many NUL characters as there were characters in the…
Ben Williams
  • 2,376
  • 4
  • 21
  • 17