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

Logrotate does not work daily, but the status file says it does

This is my logrotate script: /var/log/pyApi.log /var/log/runGet*.log { daily missingok rotate 7 compress notifempty nocreate su } Already checked /var/lib/logrotate/status, it says the last run is on 27 February 2016,…
Aminah Nuraini
  • 1,069
  • 1
  • 8
  • 15
0
votes
2 answers

Mongodb log rotation creates an extra empty log file each time it runs

I configured a new mongodb arbiter recently, and used this to test some new mongo config, using the mongo 3 config syntax, at the same time I tested log rotation on the server. This worked nicely: $ cat /etc/mongo.conf storage: dbPath:…
Rumbles
  • 994
  • 1
  • 12
  • 28
0
votes
2 answers

logrotate issue with date appending

I have an Apache server (2.2) running in RHEL 6.3, with the following logrotate configuration: # Rule for Apache logs /var/opt/apache/logs/*log { compress missingok notifempty daily rotate 15 create 0640 www_adm apache …
Peter
  • 123
  • 2
  • 5
0
votes
1 answer

logrotate saves content to old file

I used logrotate to rotate my log files. The conf file look like this: /data/log/web/12114.log { daily rotate 10 copytruncate } But logrotate doesn't cut the log file properly. The result log files look like this: -rw-r--r-- 1 root…
alex
  • 1
0
votes
1 answer

Clearing cached memory of uploaded file

On my system, I have a log file that is being rotated and uploaded every hour. This file is heavy on writes and only needs to be read when rotated and uploaded. The cached memory on my system is raising until it allocates the entire RAM and then the…
Rafa
  • 105
  • 2
0
votes
1 answer

Logrotate does not work as expected

Default logrotate rules for httpd in my CentOS 6 installation looks like this: [root@myVM ~]# cat /etc/logrotate.d/httpd /var/log/httpd/*log { missingok notifempty sharedscripts delaycompress postrotate /sbin/service…
gilbertasm
  • 95
  • 2
  • 13
0
votes
2 answers

Centos logrotate found error, skipping

One of our servers has a access_log which is nearly 5GB in size - there is currently no log rotation so I enabled it yesterday for httpd The contents of /etc/logrotate.d/httpd is /var/log/*.log { weekly missingok notifempty …
bhttoan
  • 650
  • 3
  • 15
  • 27
0
votes
1 answer

Extend "system" logrotate rules without overwriting the package's definition

The package manager installs a logrotate config file under /etc/logrotate.d for Apache2, which contains a create 640 root adm line. I want this to be a bit more liberate, e.g. create 644 root adm. I don’t like the idea of editing a file installed by…
GergelyPolonkai
  • 369
  • 1
  • 5
  • 12
0
votes
2 answers

logrotate not workig as expected

I am setting up logrotate & realized that a few of the options are either incorrectly explained/understood. My logrotate rotate 52 keyword is creating 52 files of the same log every time it rotates…
deppfx
  • 429
  • 3
  • 13
0
votes
1 answer

Issue with logrotate log based on an interval unless log exceeds a certain size?

I went though few resources in this forum like: How to rotate log based on an interval unless log exceeds a certain size? but, I don't see my log files being rotated daily. their max size for past couple of weeks are less than 10MB, but the Maxsize…
raja777m
  • 103
  • 1
0
votes
1 answer

How to filter cron messages in syslog-ng

I have a litte problem. I dont know ho to filter cron jobs in syslog-ng. It's spamming my log. Jun 05 16:09:01 CRON: pam_unix(cron:session): session opened for user root by (uid=0) Jun 05 16:09:01 /USR/SBIN/CRON: (root) CMD ( [ -x…
0
votes
1 answer

Syslog-ng and Logrotate creating sparse files

We've been using syslog-ng to log our postgres logs. On top of it we run logrotate every 5 minutes which also gzips the files. Recently, we've noted that these postgres logs contain a lot of null characters at the beginning of the file. We later…
0
votes
1 answer

Logrotate executes postrotate even if file not rotated

I have a problem with my rsyslog and imfile that fails when one of my log file gets truncated.. So to workaround the problem I have modified the logrotate script as follow: "/etc/logrotate.d/logrotate.elasticbeanstalk.tomcat7.conf": mode:…
Johny19
  • 103
  • 2
0
votes
2 answers

logrotate syntax error near unexpected token `20'

I cleared out my apache logs last week and now started to get these errors. Any ideas how I can fix this? /etc/cron.daily/logrotate: logrotate_script: -c: line 1: syntax error near unexpected token `20' logrotate_script: -c: line 1: ` find…
John Magnolia
  • 1,723
  • 6
  • 28
  • 46
0
votes
1 answer

Configure logrotate to shrink file in user's folder?

All my users in /home/{user}/ have a specific error_log file in it that may grow overtime. So I was thinking about using logrotate to implement some kind of file reducing on it : when the file reaches 500kb, we remove the first lines to reduce it to…
Cyril N.
  • 624
  • 1
  • 10
  • 36