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

How does logrotate work?

What exactly does logrotate do when it "rotates" a log file? For example, does it rename the existing file and create a new one with the old name? This article describes restarting a service after the logs are rotated, so that it can use the new log…
TS_
  • 3
  • 1
0
votes
1 answer

How to configure log rotate to compress and archive logs weekly

We have rsyslog that save logs based on requirement to various…
sarvesh.lad
  • 137
  • 6
0
votes
0 answers

Nginx/Openresty keeps creating an empty log file and writes in the previous one causing logs to never get rotated

My Django app runs on an nginx/openresty server. The user running the server is root:root but typically the app is owned by webapp:webapp. This means logs get created and written on by root. The problem is that logs aren't getting rotated because an…
dabadaba
  • 101
  • 1
  • 3
0
votes
1 answer

How to rotate compressed log file on centos 7?

I have customized kafka server and the app is creating log files and configures log rotation. My problem is that I need to compress the rotation logs that were created. I tried to create new log rotation file on /etc/logrotate.d with the following…
Rasa
  • 1
0
votes
1 answer

Rsyslog rotates, but still logging to old log

Server: Ubuntu Server 14.04 I have a Watchguard Firebox logging to a server. It is supposed to rotate daily, however, when the rotate occurs, it doesn't write to the new log. It keeps writing to the previous one. The config in…
DevOpsSauce
  • 348
  • 1
  • 5
  • 22
0
votes
1 answer

Logrotate wtmp `su prime gadmin` Contabo Ubuntu 20.04

Logrotate gives error in Ubuntu server 20.04 from Contabo VDM: Oct 31 00:00:01 foo logrotate[364456]: error: wtmp:3 unknown user 'prime' Oct 31 00:00:01 foo logrotate[364456]: error: found error in /var/log/wtmp , skipping I have in…
0
votes
2 answers

Is logrotate supposed to work only in logs inside /var/log?

I currently have a systemd service in a Ubuntu 18.04 machine that redirects the StandardOuput and StandardError to a custom path: StandardError=file:/opt/my_tests/my.log StandardOutput=file:/opt/my_test/my.log But I'd like to add a log rotation and…
ignacio
  • 101
  • 4
0
votes
1 answer

How to sort incoming log messages by their hostname & timestamp with Rsyslog?

I was curious if anyone has sorted incoming logs captured by Rsyslog by hostname and time stamp in the log. Right now I have Rsyslog sort messages by the hostname moving them to appropriate folders and then Logrotate set to daily. My concern is if…
cabotek
  • 1
  • 1
0
votes
1 answer

Logrotate - Is there a conflict?

/etc/logrotate.d/auth.conf is somnething I created manually. But there is a entry for /var/log/auth.log in /etc/logrotate.d/rsyslog as well. Is there a conflict? Do I have to remove auth.log entry from /etc/logrotate.d/rsyslog? I'm trying to manage…
user630702
  • 495
  • 10
  • 32
0
votes
0 answers

error: error creating output file /var/lib/logrotate.status.tmp: Permission denied

I am trying to logrotate my log files. Here is my configuration file: /home/deploy/apps/production_app/current/log/*.log { daily missingok rotate 52 compress create 0644 deploy deploy delaycompress notifempty …
Zia Qamar
  • 111
  • 5
0
votes
0 answers

logrotate broken yet not error message

It seems like there are quite a few common issues with logrotate not doing what it suppose to and as it happens I am in the same boat. -rw-r--r-- 1 root root 24G Jun 23 01:15 A10.log -rw-r--r-- 1 root root 0 Jun 18 12:22 A110.log -rw-r--r-- 1…
Maciej Cygan
  • 147
  • 8
0
votes
1 answer

Logrotate- restart service only if it was running

I have HA cluster with samba running on the active node, now i get these error's in my root mail: Can't find pid for destination 'smbd' error: error running non-shared postrotate script for /var/log/samba/log.smbd of '/var/log/samba/log.smbd ' Can't…
0
votes
0 answers

Logrotate: using number of files as criteria of logrotate

What I am trying to achieve is archive all log files if number of them in a folder exceed some number. Is it possible somehow ? EDITED: to be more detailed, I'll have possible several thousands of files coming hourly. So I would like archive them at…
0
votes
1 answer

SELinux logrotate issue

It seems the topic is quite popular... So I figured I have issues with my logrotate not being able to rotate tomcat logs. Logrotate configuration is set in /etc/logrotate.d/tomcat as /opt/tomcat/apache-tomcat-8.5.37/logs/catalina.out { daily …
-1
votes
1 answer

Verify that Logging is up and enabled

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 1744 apache 16w REG 202,1 0 167906281 phpapi_access_log httpd 2334 apache 16w REG 202,1 0 167906281 phpapi_access_log Above is the output of lsof…
Aso'K
  • 21
  • 6