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

SELinux permissions for LogRotate and Apache

With the directory structure: /www/live/website1/app/ /www/live/website1/files/ /www/live/website1/logs/ Where Apache needs at least the following access: app: read-only access, but read-write is fine (files already chmod 0644) files: read-write…
Craig Francis
  • 633
  • 1
  • 8
  • 23
4
votes
1 answer

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: { compress copytruncate delaycompress dateext missingok notifempty daily rotate 30 } There is…
user2206396
  • 221
  • 1
  • 2
  • 6
4
votes
1 answer

Can I manually compress file when logrotate with delaycompress is active

I have a daily logrotate set up with compress, missingok, delaycompress, dateext options. I need to compress the delayed log file. Can I do it manually now or should I wait till logrotate does it when it runs. I'm just not sure whether logrotate has…
rATRIJS
  • 141
  • 3
4
votes
1 answer

can logrotate process all *.log in a directory tree?

Logrotate can work on individual files or wildcarded files (*.log, for example) in a specified directory, but does it inherently have the ability to traverse a directory tree of arbitrary depth and process files it finds? thanx
user52874
  • 829
  • 2
  • 12
  • 26
4
votes
1 answer

Understanding reference to /var/log/wtmp in /etc/logrotate.conf

I have the following lines in my /etc/logrotate.conf file which I'm not quite sure what they do: (Edited in to show full file) # see "man logrotate" for details # rotate log files weekly weekly # keep 52 weeks worth of backlogs rotate 52 # <--…
siliconpi
  • 1,807
  • 6
  • 32
  • 46
4
votes
3 answers

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-rotation/) where someone wants to disable log…
Manfred Moser
  • 173
  • 1
  • 7
4
votes
1 answer

NGINX service rotate doesn't use new log files

I'm having issues with any commands which tell nginx to use new log files. I'm using Ubuntu 18.04, nginx/1.14.0, logrotate 3.11.0 If I create new access.log or error.log files in /var/log/nginx, either manually or via logrotate, they do not get used…
x3nr0s
  • 289
  • 2
  • 5
  • 13
3
votes
1 answer

Does logrotate.conf override the config of the submodules?

I wonder which of the logs takes precedence over the other. Looking at rsyslog defined here, it defines daily rotation and keeping them for 30 days. vim /etc/logrotate.d/rsyslog /var/log/syslog { rotate 30 daily missingok …
Houman
  • 1,545
  • 4
  • 22
  • 36
3
votes
2 answers

How does logrotate deal with copytruncate?

I understand that copytruncate is not an ideal setup, but that's the cards I'm dealt with... I have a service that is tailing data from journalctl and streaming it to a file. The setup to rotate the file is... /var/log/xxxxxx/xxxxxx.log { size…
user432024
  • 283
  • 1
  • 5
  • 15
3
votes
1 answer

kubernetes kubelet logging to files and logrotate

kubelet has an option to store log files in a log-dir (https://github.com/kubernetes/kubernetes/issues/21248). I start kubelet with the options --logtostderr=false --log-dir=/var/log/kubelet (I have already created the directory /var/log/kubelet)…
3
votes
0 answers

How to setup logrotate properly for multiple systemd services, which sends their stdout, stderr to rsyslog

Suppose I have many systemd service units on ubuntu 16.04 which looks like this: [Unit] Description=Do something…
vskubriev
  • 686
  • 9
  • 15
3
votes
1 answer

How logrotate behave when there is * and there is one explicit filename in log rotation in one path?

The question is little bit long! Let me explain with the example below. I have a log-rotation configuration file in /etc/logrotate.d/ which is used for uwsgi: "/var/log/uwsgi/*.log" "/var/log/uwsgi/*/*.log" { copytruncate daily rotate 5 …
Alireza
  • 583
  • 4
  • 9
  • 27
3
votes
1 answer

Elastic Beanstalk Log Rotation Causing Apache Restart

I have already worked through AWS Elastic Beanstalk - Apache is restarting constantly Our elastic beanstalk instances are reporting the following message in the error_log [Mon Jun 26 22:01:01.878892 2017] [mpm_prefork:notice] [pid 8595] AH00173:…
samazi
  • 131
  • 1
  • 5
3
votes
1 answer

Use Logrotate to truncate log files after every entry or clear last 'n' entries

i have created a logrotate config file: touch /etc/logrotate.d/.test with the conficurations: /home/myUser/test*.log{ size 0 hourly rotate 0 nocreate nocompress missingok nocopytruncate ifempty } I want to be…
ioaniatr
  • 131
  • 1
  • 4
3
votes
4 answers

Pruning of backup files as they get older

I'm looking for a tool (for Linux) that will prune my backup files, not like the standard logrotate that completely deletes them after defined number of rotations, but where the files are basically kept permanently, except they are pruned as they…
TheStoryCoder
  • 254
  • 3
  • 13