Questions tagged [logrotate]

A program for managing and archiving individual log files. It allows automatic rotation, compression, removal, and mailing of log files. Jobs can be configured to run hourly, daily, weekly, monthly, yearly or when reaching a certain size or age.

For details see the logrotate manpage.

99 questions
41
votes
2 answers

Specify the time of daily log rotate

I noticed that daily log rotations which are listed under /etc/logrotate.d/ are executed in the morning around 6:40 am. This is clear from the beginning and ending of the log files. Can I customize this time and set it to midnight for example? It is…
Khaled
  • 1,682
27
votes
1 answer

What schedules logrotate?

I'm working on the program which creates a big log file. I want to handle it with logrotate. This is a configuration I put to /etc/logrotate.d/: /var/log/myproject.log { hourly maxsize 1 rotate 6 missingok notifempty compress nocreate …
26
votes
1 answer

Configuring logrotate without root access (per user log rotation)

How best can logrotate be configured, on a per-user basis, to rotate files in the home directory of the user, under control of a per-user crontab -e?
Bryce
  • 2,007
11
votes
5 answers

/var/log/syslog not rotating

Our log file /var/log/syslog does not seem to be rotating, even though the logrotate config /etc/logrotate.d/rsyslog exists: /var/log/syslog { rotate 7 daily missingok notifempty delaycompress compress postrotate …
Justin
  • 531
10
votes
2 answers

Upstart not reopening log files on logrotation

We use upstart to manage our services on our Ubuntu servers. They produce logs which are logged out to /var/log/upstart/SERVICE_NAME.log Then daily, the log files are rotated using the logrotation script which comes with 12.04…
9
votes
2 answers

Which script rotates /var/log/auth.log?

I cannot figure out where /var/log/auth.log is rotated. I found the file /var/log/auth.log.2013-09-16 on my system, which contains log entries previously found in /var/log/auth.log. Where does that file come from? I added the -d -D '%Y-%m-%d'…
9
votes
2 answers

logrotate succeeds when manually run as root, but fails with "Read-only file system" when run by logrotate.service

I have a (formerly working) logrotate setup for OpenResty that I took from a previous Ubuntu 18.04 installation. Yet the logrotate.service fails with this error now ... error: error renaming /usr/local/openresty/nginx/logs/access.log.60.zst to…
9
votes
1 answer

What is the syntax for commenting out lines in logrotate config files?

Not sure if this is possible at all. And what about empty lines? Update: Testing the config with logrotate -d /etc/logrotate.d/apache2 returns error: /etc/logrotate.d/apache2:1 lines must begin with a keyword or a filename (possibly in double…
8
votes
2 answers

Purpose of "postrotate invoke-rc.d rsyslog rotate" when logrotating, and is this command outdated?

When using logrotate to keep log files rotating, I have seen postrotate invoke-rc.d rsyslog rotate > /dev/null endscript I know postrotate makes bash execute the following command after the log file is rotated, but what is the…
fpghost
  • 1,659
  • 4
  • 24
  • 35
8
votes
2 answers

How To rotate syslog daily?

I want to rotate my syslog daily... How do I do this? How to check whether log rotate is working? How to make it run daily? By default, does Ubuntu Server run logrotate daily? Or do I have to set it after installation?
THpubs
  • 2,815
7
votes
1 answer

logrotate fails to rotate logs: error setting owner

Recently I've noticed that logrotate does not rotate my logs. user1@host:~$ /usr/sbin/logrotate /home/user1/logrotate.conf -v gives me an error: error: error setting owner of /home/logs/mylog.log.1 to uid 10111 and gid 10111: Operation not…
hdf
  • 171
  • 1
  • 1
  • 4
7
votes
3 answers

Nginx logrotate logs

I am running Ubuntu 15.04 and have a standard installation of nginx (apt-get install nginx) running. Everything is running fine but I notice that the nginx logs are being rotated but nginx carries on outputting to the same log file e.g.…
willwade
  • 173
7
votes
2 answers

Ubuntu 14.04 - logrotate does not rotate /var/log/* (rsyslog config)

I have a bunch of Ubuntu 14.04 servers I manage where logrotate is not rotating anything under /var/log/*. I'm going to assume its an issue with the /etc/logrotate.d/rsyslog as I see other entries in /etc/logrotate.d/ rotating logs properly. These…
7
votes
3 answers

How to prevent logs from getting too big?

I have a cronjob that runs some Python scripts and they generate massive log file. How do I prevent them from getting so big? It'd be perfect if the file was deleted once it hit a certain size. Because every few days, the file is 50MB now but gets…
User
  • 171
6
votes
3 answers

MySQL logrotate error

I'm new to Linux and have setup a VPS running Ubuntu 16.04 with postfix, dovecot and rouncube using mariadb for the database. It all seem to be working okay but I regularly receive the following email: /etc/cron.daily/logrotate: mysqladmin: connect…
Adam D
  • 61
  • 1
  • 2
1
2 3 4 5 6 7