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.

learn more… | top users | synonyms

18
votes
4answers
3k views

Equivalent of logrotate on OSX

Is logrotate hiding somewhere on OSX, or is there an equivalent? It's not in /usr/sbin.
17
votes
1answer
12k views

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.)
15
votes
4answers
12k views

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 ...
14
votes
4answers
12k views

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?
13
votes
8answers
4k views

Continuosly 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 ...
13
votes
3answers
3k views

Logrotate and Open Files

How does logrotate handle open files? Can logrotate rotate files that a process has open?
12
votes
5answers
2k views

Grepping through .gz log files

Does there exist a magical shell piping which would allow easily to grep through bunch of .gz log files without needing to extract them somewhere? .gz files are Apache logs, result of log rotation. ...
12
votes
3answers
805 views

How to continue redirecting stdout to a file after logrotate moves it?

I have a simple script which outputs a bunch of logs to screen and I piped the STDOUT to a file to store the logs. Since this script is long running, I needed to rotate the log files so they are ...
12
votes
2answers
10k views

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 ...
11
votes
2answers
7k views

Logrotate not working

I am trying to get logrotate to work on my VPS to rotate my apache files weekly. Currently the contents of the apache2 config file is as such. "/var/www/user/site.com/logs/*.log" { weekly ...
10
votes
3answers
8k views
10
votes
3answers
6k views

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 somehow? We're looking at about 300 MB ...
9
votes
2answers
3k views

Logrotate: how to access the output file in postrotate

I rotate Nginx logs daily (with dateext). After the rotation I want to parse the file for the day that just passed and compile an email with the number of errors returned by Nginx server. How can I ...
9
votes
1answer
2k views

How to rotate log based on an interval unless log exceeds a certain size?

From the man page of logrotate: minsize size Log files are rotated when they grow bigger than size bytes, but not before the additionally specified time interval (daily, weekly, monthly, ...
9
votes
5answers
8k views

Proper way to rotate Nginx logs

I would like to achieve rotation of nginx logs that: would work without any extra software (i.e. - best if without "logrotate") would create rotated files with names based on date Best approach is ...
9
votes
2answers
3k views

MySQL doesn't logs error to new file after rotating?

Problem solved but I'm writing down for the future reference. /root/.my.cnf [mysqladmin] user = root password = pa$$w0rd /etc/logrotate.d/mysql /var/log/mysql-slow.log ...
9
votes
1answer
2k views

How can I rotate many log files into a different subdirectory per rotation?

I have a directory with many log files, all of which I would like to rotate daily. For organizational purposes I would like to be able to move the rotated logs into a different directory (or ...
8
votes
3answers
6k views

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 ...
8
votes
4answers
4k views

Cronolog vs logrotate

Which log rotation tool do you prefer?
8
votes
3answers
3k views

Logrotate: Rotating non-log files?

I have a backup script that compresses various files and directories and creates .tgz archives. Files are named, e.g. ... backup_2010-10-28.tar.gz backup_2010-10-29.tar.gz backup_2010-10-30.tar.gz ...
8
votes
3answers
12k views

When & how does logrotate run under Ubuntu 10.04?

I am new to sysadmining and have a few questions: Where and how is the logrotate procedure initaited by the system? What time of day are my "daily" rotated logfiles being rotated? Do the prerotate ...
8
votes
2answers
11k views

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 ...
8
votes
3answers
455 views

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, ...
8
votes
2answers
3k views

Apache2 and logrotate: delaycompress needed?

I am currently looking at the file size of my Apache logs as they became huge. In my logrotate conf, I have delaycompress enabled. Does Apache really need this (as the logrotate documentation says ...
7
votes
3answers
4k views

Logrotate Successful, original file goes back to original size

Has anyone had any issues with logrotate before that causes a log file to get rotated and then go back to the same size it originally was? Here's my findings: Logrotate Script: ...
7
votes
3answers
7k views

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 ...
7
votes
2answers
5k views

What are pros and cons of logrotate vs rotatelogs with Apache?

Apache provides a tool called rotatelogs which has the benefit of not restarting apache when rotating logs which happens with logrotate. I do not have enough experience to speak if this is enough ...
7
votes
5answers
15k views

logrotate does not compress /var/log/messages

Over time I noticed some logs in /var/log such as auth, kern and messages were getting huge. I made logrotate entries for them: $ cat /etc/logrotate.d/auth.log /var/log/kern.log { rotate 5 ...
6
votes
4answers
2k views

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 ...
6
votes
2answers
309 views

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 ...
6
votes
2answers
3k views

rotate nohup out file (nohup.log)

is there a 'native' way where i can rotate nohup out file ?
5
votes
3answers
5k views

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 ...
5
votes
1answer
167 views

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? ...
5
votes
5answers
234 views

How should I deal with logs before they get to big?

I found out my disk was full today, and I freed up 10% just from deleting mostly logs from multiple websites. I, personally, like to keep logs as an archive, because I may need to look back on them ...
5
votes
1answer
161 views

Cron daemon reporting “unknown user 'tomcat6'” every day since I removed tomcat

I'm running Ubuntu 12.04. Since I removed tomcat via aptitude purge the other day, I keep getting the following error from Cron daily: /etc/cron.daily/logrotate: error: tomcat6:7 unknown user ...
5
votes
2answers
2k views

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 ...
5
votes
4answers
4k views

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 ...
5
votes
4answers
2k views

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 ...
5
votes
1answer
4k views

Logrotate does not remove old logs

for some reason the old log files are not deleted. Example with apache What the conf file says: $ cat /etc/logrotate.d/apache2 /var/log/apache2/*.log { weekly missingok rotate 2 ...
4
votes
2answers
2k views

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 ...
4
votes
2answers
4k views

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 ...
4
votes
3answers
1k views

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 ...
4
votes
1answer
974 views

I want my logs sent to my mail with logrotate

Not strictly a question about programming as such, more of a log handling question. Anyway. My company has multiple clients, and each of these clients have a set of logs that I'd rather much want to ...
4
votes
4answers
3k views

Daily Weekly and Monthly DB backup with logrotate?

I am currently keeping daily backup of my database by doing a daily mysqldump and by using logrotate to keep the 7 last days of mysqldump. I would like to improve this backup process to keep 7 daily ...
4
votes
1answer
783 views

Rotating logs generated by a process that logs to stdin

I have a long running process, that writes its log file to stdout. I would like to save this output to different files, automatically maintain these files (like deleting/archiving the old ones), ...
4
votes
1answer
1k views

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 ...
3
votes
3answers
3k views

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 ...
3
votes
3answers
8k views

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 ...
3
votes
1answer
5k views

manually rotating logfile with rsyslogd

I want to force logfile rotation using logrotate -f /var/log/syslog, but it's only return tones of: error: syslog:1 unknown option 'May' -- ignoring line error: syslog:1 unexpected text I know that ...
3
votes
2answers
27 views

logrotate not emailing log

My logs are being rotated properly, however, I am not being emailed the rotated log. What am I doing wrong? My main logrotate.conf is: include /etc/logrotate.d here is my ...