Skip to main content

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.

Filter by
Sorted by
Tagged with
85 votes
4 answers
111k 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.)
ithinkihaveacat's user avatar
74 votes
5 answers
139k 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?
user avatar
64 votes
5 answers
25k views

Equivalent of logrotate on OSX

Is logrotate hiding somewhere on OSX, or is there an equivalent? It's not in /usr/sbin.
Steve Bennett's user avatar
59 votes
4 answers
96k 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 ...
cat pants's user avatar
  • 2,313
53 votes
6 answers
88k views

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 ...
enedebe's user avatar
  • 1,096
52 votes
4 answers
91k 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 ...
Anand Chitipothu's user avatar
38 votes
3 answers
50k 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 ...
Kyle Brandt's user avatar
  • 84.6k
36 votes
6 answers
128k 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 ...
Carmen's user avatar
  • 817
34 votes
4 answers
61k 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? We're looking at about 300 MB an hour ...
mfinni's user avatar
  • 36.3k
29 votes
6 answers
19k 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 ...
James Antill's user avatar
29 votes
3 answers
40k views

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

There's a way to do this?
Guilherme's user avatar
  • 761
26 votes
1 answer
30k 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, or ...
Question Overflow's user avatar
25 votes
3 answers
22k views

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 ...
Ben Torell's user avatar
24 votes
7 answers
15k views

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 ...
xkcd150's user avatar
  • 928
24 votes
5 answers
52k views

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 ...
Mattan's user avatar
  • 343
24 votes
6 answers
27k 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 ...
jen's user avatar
  • 243
23 votes
3 answers
15k views

Logrotate and Open Files

How does logrotate handle open files? Can logrotate rotate files that a process has open?
Kyle Brandt's user avatar
  • 84.6k
22 votes
4 answers
12k 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 ...
Mehran's user avatar
  • 519
21 votes
6 answers
52k views

Mongodb - proper way to rotate logs

Mongo docs say that I can: use -SIGUSR1 signal and get the old log renamed and current switched use logrotate from OS I want the OS's logrotate ability to zip old files and remove oldest, but see no ...
Andrey Regentov's user avatar
20 votes
5 answers
65k 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 ...
Malachi's user avatar
  • 441
20 votes
1 answer
56k views

Linux: How to enforce specific permissions on newly created logs which are created by log rotate?

I've noticed that the mail logs which are being created in /var/log are being created and owned by root (user and group). I've written a Nagios check which monitors the log and in order to allow the ...
Itai Ganot's user avatar
  • 10.9k
19 votes
4 answers
19k views

How to specify exceptions from wildcard settings in a logrotate configuration file?

For my logfiles I have the problem of all but one (or a few) files use the same configuration, while the rest has another one. I tried to realize this by giving a general configuration for all files ...
MRA's user avatar
  • 317
18 votes
5 answers
19k 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. I'...
Mikko Ohtamaa's user avatar
18 votes
1 answer
50k 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 ...
kbec's user avatar
  • 1,023
18 votes
2 answers
61k views

Delete files with logrotate

Is it possible JUST to delete the log files in a directory by using logrotate w/o actually rotating them? We have an app that generates logs in the following format: app.log.DD_MM_YYYY. I am ...
Iulian's user avatar
  • 428
17 votes
4 answers
21k 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: /var/log/mylogfile....
drewrockshard's user avatar
17 votes
3 answers
31k 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 ...
user avatar
16 votes
2 answers
10k 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 ...
ibz's user avatar
  • 345
16 votes
3 answers
106k 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 ...
Mike Mazur's user avatar
  • 6,323
16 votes
1 answer
40k views

logrotate by size - do I need to change the cron?

My current logrotate configuration looks like this (using logrotate 3.8.7) "/var/log/haproxy.log" { daily size 250M rotate 1 create 644 root root missingok compress notifempty ...
Hommer Smith's user avatar
16 votes
1 answer
14k views

Why is logrotate causing Apache to seg fault each time?

Every time logrotate runs Apache/2.4.7 (Ubuntu) experiences a seg fault and does not restart: [Wed Sep 10 06:35:54.266018 2014] [mpm_event:notice] [pid 20599:tid 140630283466624] AH00493: SIGUSR1 ...
fpghost's user avatar
  • 703
16 votes
2 answers
27k 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 ...
Dave Forgac's user avatar
  • 3,606
15 votes
2 answers
34k 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 ...
SamK's user avatar
  • 1,366
15 votes
5 answers
16k 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 /var/log/...
quanta's user avatar
  • 52k
13 votes
1 answer
24k views

How to rotate a log file from crontab?

I have this directive on my crontab: * * * * * /var/www/github/mysite/bin/email email worker await --pid=/var/run/mysite-worker-email.pid >> /tmp/mysite-worker-email.log As you can see all my ...
DomingoSL's user avatar
  • 395
13 votes
2 answers
41k views

Logrotate not rotating file after file size exceeds the limit.

From logrotate manpage. It will not modify a log more than once in one day unless the criterion for that log is based on the log's size According to the man page, logrotate should rotate ...
robert's user avatar
  • 243
13 votes
4 answers
15k 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 ...
user avatar
12 votes
3 answers
11k views

How to stop logrotate from changing the rotated logs owner

I have a logfile owner by the 'apache' user that I would like to rotate with logrotate. I would like to do that by running logrotate as a different user, say 'web' using the copytruncate strategy. ...
Leven's user avatar
  • 221
11 votes
6 answers
37k views

logrotate won't rotate my logs automatically

I have two different (i386 v AMD) Debian boxes and have the same problem. logrotate won't rotate my logs automatically. It works fine when i force it manually like /usr/sbin/logrotate -f /etc/...
fabrik's user avatar
  • 527
11 votes
3 answers
21k views

Why does my CentOS logrotate run at random times?

I put a logrotate configuration file in /etc/logrotate.d/ and expected the logs to rotate at a consistent time; however, they do not... log rotation times are seemingly random +/- one hour. Why are ...
Mike Pennington's user avatar
11 votes
4 answers
12k views

Cronolog vs logrotate

Which log rotation tool do you prefer?
Unknown's user avatar
  • 1,725
11 votes
1 answer
9k views

Manually rotate a log file

I have an Ubuntu web server running Nginx. I had never configured logfile rotation and have just discovered some multi-gigabyte monolithic log files. I have configured log rotation now per these tips....
Phrogz's user avatar
  • 563
11 votes
3 answers
6k views

Does fail2ban monitor rotated log files?

Does fail2ban continue to monitor rotated log files? For example, I have a rule monitoring /var/log/fail2ban.log which is automatically rotated by the system every week (7 days). I want to have a ...
J. Chin's user avatar
  • 615
11 votes
2 answers
13k 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 ...
Mohan Gulati's user avatar
10 votes
3 answers
10k 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 ...
John F. Miller's user avatar
10 votes
6 answers
53k 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 ...
Guillaume's user avatar
  • 1,063
10 votes
2 answers
12k 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 ...
Vincent B.'s user avatar
10 votes
2 answers
8k views

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....
c33s's user avatar
  • 1,555
10 votes
2 answers
7k 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 configuration, I have delaycompress enabled. Does Apache really need this (as the logrotate documentation ...
j0nes's user avatar
  • 955
10 votes
1 answer
6k 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), ...
SztupY's user avatar
  • 265

1
2 3 4 5
9