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

SELinux - logrotate is not rotating NGINX logs

I am using CentOS, NGINX and Passenger to serve a Rails application. I have SELinux activated, and have had a series of problems with logrotate. I have been able to resolve most of the issues by following various advice online. Unfortunately,…
niciliketo
  • 71
  • 2
  • 6
2
votes
1 answer

Why is logrotate deleting my logs?

This is my conf: /var/log/apache2/*.log { weekly missingok rotate 52 compress delaycompress notifempty create 640 root adm sharedscripts postrotate if…
Badr Hari
  • 163
  • 2
  • 11
2
votes
1 answer

How to let logrotate skip non-existent and empty files

We have the following pronblem. Once in a while, our application server spits out an empty logfile or (when it's in the weekend), there is no logfile at all. We use logrotate for managing these logfiles and in both cases, we want logrotate to skip…
2
votes
2 answers

Apache logrotate with different names for current and archives

I'm running Apache 2.2 on CentOS 6.5 and what I'd like to do is have Apache's current access log file be: /var/log/httpd/access_log And each day at midnight, that file is renamed like so (assume 2014-09-22 is the date that just…
dirtside
  • 1,551
  • 5
  • 17
  • 22
2
votes
2 answers

Changing LogRotate's default way of rotating the log files

My observation of logrotation is that to rotate any log file, the logrotate process, in the following order copies the log file in question (lets call it file1.log) with a new name (adding time stamp or a number to the existing name so that it…
Gautam Somani
  • 296
  • 3
  • 14
2
votes
1 answer

does the sharedscripts setting for logrotate apply to all processed logs, or only those in the current context?

So I have a number of apache logs I like to handle with logrotate on a developer box. Some of them are for user sandboxes, others are for staging versions and such. The logrotate config looks…
2
votes
2 answers

Log rotate log from standard out

I have a program which takes an argument to allow extra debug from a piece of hardware we use. The log is just written to standard out so normally we just pipe the standard out to a file i.e. ./myprog -AddDebug > myfile.txt, however we are now…
Boardy
  • 258
  • 1
  • 4
  • 23
2
votes
2 answers

Rotatelogs rotating log files mid log entry

I have a c++ tool that outputs to STDOUT via printf i.e. printf ("%s\n", logline); I then pipe that to rotatelogs i.e. tool | rotatelogs /tmp/logs/log_%s 60 Everything works great, but rotatelogs will rotate mid line so log file 1 has this…
2
votes
3 answers

Logrotate ERROR: No file found for /var/log/apache*/*error.log

Logrotate runs daily and emails me a report. This has been working fine however I now get the following email daily also: Date: Mon, 10 Aug 2009 04:02:08 +0100 From: root@localhost.localdomain (Cron Daemon) To: root@localhost.localdomain Subject:…
2
votes
1 answer

unix logrotate specify chunk size

How can I specify output file size which I want after rotation? For example lets say I want to run logrotate when log file reaches 10MB and I want to split this log into chunks which are 1MB max. I have found options "size" but this sets limit above…
Wakan Tanka
  • 153
  • 8
2
votes
1 answer

How backup files with logrotate and Amazon S3?

I would like to create a new standard of two things: how long would be generated and be rotated the logs generated by my applications ? how to transfer the logs to Amazon S3, as a backup server ?. I was thinking in use logrotate, to rotate and…
Valter Silva
  • 155
  • 1
  • 4
  • 14
2
votes
2 answers

Logrotate rotating daily but should be rotating weekly

For some reason logrotate is rotating logs daily instead of weekly, even though all the config files for logrotate seem to be set to weekly. Any ideas? /etc/cron.daily/logrotate #!/bin/sh test -x /usr/sbin/logrotate || exit 0 /usr/sbin/logrotate…
2
votes
1 answer

Rotating Iptables logs with logrotate

I'm running CentOS6 and I configured rsyslog to monitor my iptables warning messages and dump them in /var/log/iptables.log. I went through my logrotate.d/syslog file and added iptables.log so logrotate would pick up and rotate the logs. The file…
FloppyDisk
  • 123
  • 1
  • 4
2
votes
1 answer

Logrotate get created file name

I can produce file truncated from original log file with timestamp extention (%y%m%d%s). How can I get the name of created file in order to use this name in 'postrotate'. The following conf file does not work at a time when rotation takes…
Ahmet Karakaya
  • 243
  • 6
  • 18
2
votes
1 answer

logrotate : Contents are missing

I'm using logrotate to rotate my log file periodically (in my case every 1 hour checking for log file size and rotate if needed using cron). I'm facing a serious issue in it. The following files should have been created -- user.log.gz.4,…
karthi_ms