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
9 votes
4 answers
6k 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 ...
Alexander Gladysh's user avatar
36 votes
6 answers
126k 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
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
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
85 votes
4 answers
110k 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
59 votes
4 answers
94k 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,293
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
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
18 votes
5 answers
18k 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
16 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
5 votes
1 answer
12k views

logrotate cron job not rotating certain logs

I added two scripts in "logrotate.d" directory for my application logs to be rotated. This is the config for one of them: <myLogFilePath> { compress copytruncate delaycompress dateext ...
user2206396's user avatar
3 votes
2 answers
3k views

Null bytes in a file created by 2> rotated with logrotate?

I'm using the script utility to record terminal sessions, and using logrotate (with copytruncate, script ignores HUP and keeps writing to the rotated file otherwise) to periodically upload chunks of ...
Jeremy Wadhams's user avatar
2 votes
2 answers
7k views

Logrotate configuration for httpd (CentOS)

I'm running Apache 2.2.3 on CentOS 5.5 and just noticed the following logrotate postrotate configuration in /etc/logrotate.d/httpd: postrotate /sbin/service httpd reload > /dev/null 2>/dev/null ...
Ralph's user avatar
  • 105
2 votes
1 answer
879 views

log-rotation not working properly

I have created log rotation but it seems not working for me, as it's creating a large number of files like "smartfox.log.2020-01-05-07.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1" Furthermore, rotate 3 and ...
Ashish Karpe's user avatar
74 votes
5 answers
137k 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
24k 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
38 votes
3 answers
49k 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.4k
34 votes
4 answers
60k 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.2k
21 votes
6 answers
51k 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
15 votes
5 answers
15k 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
  • 51.8k
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
8 votes
3 answers
7k 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 ...
Ether's user avatar
  • 322
6 votes
4 answers
5k views

Is there any alternate to logrotate for apache logs?

I need an alternate for rotating logs on my server, everytime logrotate runs apache goes down for like 10-20 minutes, i'm not sure if this is right, but don't seem right for me. Is there any ...
Rod's user avatar
  • 371
6 votes
1 answer
10k views

How do you rotate apache logs on windows without interrupting service?

I administrate a Windows Server 2003 (Standard Edition, 32-bit) installation running Apache2 and ColdFusion. The server has over 100 virtual hosts, each with an access log and an error log. I've been ...
Joe's user avatar
  • 1,775
4 votes
3 answers
3k views

Benefits of log rotation

I have been using logrotation for years and never thought too much of it being a problem until I came across a question on stackoverflow (https://stackoverflow.com/questions/1508734/disable-java-log-...
Manfred Moser's user avatar
3 votes
1 answer
8k views

Making logrotate remove old logs after reducing 'rotate' value

I'm trying to reduce the number of log files kept for Apache by reducing 'rotate 52' in /etc/logrotate.d/apache2 to 'rotate 8'. With weekly rotation this should keep 2 months of logs instead of a full ...
Martijn Heemels's user avatar
3 votes
3 answers
468 views

logrotate security

Are there any concerns about the security of logrotate running as root? Had someone ask couldn't a malicious user subvert the config to overwrite anything? Is is okay to run logrotate out of the ...
pzod's user avatar
  • 117
2 votes
1 answer
5k views

mysql root password - where should it be stored?

Where is the best place to store the mysql root password? I had been putting it only in the root user's /root/.my.cnf file, which works fine for doing normal updates, backups, etc. However, the (...
Daniel's user avatar
  • 180
2 votes
1 answer
215 views

logrotate fails to run Java postrotate program

Somewhat recent versions of logrotate fail to execute postrotate actions that invoke Java when logrotate is started via systemd. In my logs I see: logrotate[123]: Error occurred during initialization ...
C-Otto's user avatar
  • 374
2 votes
2 answers
4k views

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. ./...
Boardy's user avatar
  • 268
2 votes
2 answers
3k views

Preventing logrotate's dateext from overwriting files

I'm working with a system where I would like to use the dateext function of logrotate (or some other way) to add the date to a logfile when it is rotated. However in this system it is important that ...
Thirler's user avatar
  • 156
1 vote
3 answers
6k views

Apache access log rotation

I think my system is using logrotate for rotating logs including httpd logs The "current" files is logged here /var/log/httpd/ but I only see the last 5 days(I think) But how can I find where ...
user avatar
1 vote
1 answer
2k views

Daily queries log file

Has MySQL a daily log rotation system? like Apache that creates daily log files? I'm having a very hard time to find any good info about this. Win Server 2008 R2 MySQL 5.1.11 I'm logging all (...
Johan Larsson's user avatar
0 votes
2 answers
2k views

logrotate fails to instruct Apache to reopen logs on Amazon Linux

I have very good experience with logrotate normally, but on a recent installation using "Amazon Linux" (CentOS 6 deployed by Amazon) on EC2, logrotate fails to cause Apache to reopen its logs. The ...
Guss's user avatar
  • 2,830