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.
442
questions
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 ...
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 ...
4
votes
1
answer
9k
views
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, ...
0
votes
1
answer
446
views
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 ...
0
votes
3
answers
10k
views
Configuring Logrotate for Fluentd files. Necessary?
I have the following fluent.conf
<source>
type forward
</source>
<source>
type monitor_agent
port 24220
</source>
# Listen DRb for debug
<source>
type ...
0
votes
1
answer
434
views
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 ...
0
votes
0
answers
3k
views
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 ...
0
votes
0
answers
39
views
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 ...
1
vote
1
answer
629
views
logrotate mariadb not workin as expected
i'm trying to configure logrotate for mariadb log files,
Environment:
system : RHEL 8.2
logrotate : 3.14.0
mariadb: 10.4
the file is
/var/lib/mysql/SITE2-L-MANAGEDPKI-01.log{
missingok
...
8
votes
2
answers
16k
views
How can I get logrotate dateext to reflect the log date rather than the rotation date?
My Apache logrotate config looks like this:
/var/log/http/*log {
monthly
dateext
dateformat .%Y.%m
[... rest stripped for brevity ...]
}
This works great, except that the date on the ...
1
vote
0
answers
239
views
docker: logrotate is failing with missing directories in pattern
I'm using logrotate in a docker container. I'm injecting a bind volume into the container where logs should be rotated.
The folder structure is more or less the same, this path /srv/apps is injected ...
2
votes
1
answer
8k
views
Logrotate maxsize with minsize
I wonder if maxsize and minsize can both be added with a specified time interval and can thus coexist. With these options both the size and timestamp of a log file are considered, so if it happens ...
1
vote
3
answers
8k
views
wildfly and logrotate: wildfly still logs messages to already rotated server.log
For wildfly (on linux) I need following logging scenario: daily rotation of server.log and removing old log files which are older than 90 days. I don't see a way to configure this in wildfly/log4j (...
1
vote
0
answers
694
views
logrotate codeigniter logs, keep 7 days only
I'm trying to rotate logs produced by CodeIgniter, they are named this way (one per day)
log-2020-05-05.php
log-2020-05-06.php
log-2020-05-07.php
The idea is to package this in a debian package for ...
1
vote
1
answer
604
views
Logrotate docker container's logs when user doesn't exist on host
I mounted my containers' logs to the host (e.g. /var/log/container1, etc). Now I want to use the host's logrotate.
But suppose I need to do this:
create 660 mysql mysql
There is no mysql user/group ...
0
votes
0
answers
53
views
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 ...
12
votes
3
answers
10k
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.
...
0
votes
1
answer
1k
views
logrotate deletes all maillogs older than one day
I see only two files maillog and maillog.1 in /var/log.
grepping for maillog in logrotate.d directory gives three files that have a mention of maillog.
syslog
/var/log/messages /var/log/secure /var/...
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/...
1
vote
0
answers
193
views
logrotate seems to be working but does not rotate a log file
Here is my logs directory:
root@my-server:/var/www/vhosts/my-website/logs# ll
total 1468016
-rw-r--r-- 1 my-website webuser 95719295 Mar 19 18:04 my-website-access.log
-rw-r--r-- 1 my-website ...
1
vote
1
answer
488
views
Log Rotate doesn't rotate logs [duplicate]
I have a logrotate running on Aws ec2 instance which is trying to rotate logs under /var/log/tomcat8/ every hour. I have below configuration under /etc/logrotate.d/rotate_tomcat:
"/var/log/tomcat8/...
0
votes
2
answers
2k
views
Log files randomly stops writing to log files
I'm currently running Debian 10.1 x64
The problem started pretty much right after setting up the server.
Every now and then it seems like my system stops writing to the log files. If I check /var/log ...
2
votes
2
answers
4k
views
Logrotate rotating daily but should be rotating weekly
For some reason logrotate is rotating logs daily instead of weekly, even though all the config files for logrotate seem to be set to weekly. Any ideas?
/etc/cron.daily/logrotate
#!/bin/sh
test -x /...
52
votes
6
answers
85k
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 ...
74
votes
5
answers
136k
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?
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 ...
0
votes
1
answer
162
views
logrotate mysql not deleting old files
I have set logrotate for MySQL as follows:
/var/lib/mysql/SITE1-L-MPKI-01.log {
create 640 mysql mysql
daily
rotate 7
missingok
compress
copytruncate
postrotate
# just if ...
2
votes
1
answer
873
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 ...
4
votes
1
answer
642
views
Logcheck Ignore Logrotate
I inherited a system using both logcheck and logrotate. The issue I'm having is that logrotate is sending a nasty e-mail saying something along the lines of:
*** WARNING ***: Log file (X) is smaller ...
2
votes
1
answer
12k
views
Logrotate: glob finding old rotated logs failed
I am having problems with logrotate. The configuration is the following
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/unused.log
/var/log/kern.log
/var/...
9
votes
4
answers
12k
views
log rotation --Windows [closed]
I am looking into log rotation for our web server (not apache) on Windows. I have heard of cronolog, CHOMP, and others. Does Windows have a built-in rotation .exe? What have you found to be a good ...
1
vote
1
answer
5k
views
Run anacron at 11:59 PM
I am trying to run may logrotator using following anacron setup to run it at 11:59 PM as daily task.
My current setting for /etc/anacrontab
# /etc/anacrontab: configuration file for anacron
# See ...
0
votes
0
answers
62
views
Centos - logrotate won't rotate
I have /etc/logrotate.d/httpd settled as :
/var/log/httpd/* {
rotate 3
size 10k
missingok
notifempty
sharedscripts
postrotate
service httpd restart
endscript
}
but ...
8
votes
1
answer
2k
views
How does logrotate handle concurrency?
In the case that logrotate runs the same time as the log file is being updated, what will happen?
Will the new log be rotated into a historical log file? Or it will stay in the current log file?
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.
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 ...
2
votes
1
answer
91
views
Apache outputting without .log
I am trying to fix an issue where an apache log is filling the /var/log/ partition. It is a single log in apache2 that is almost 4GB. I have set logrotate to rotate out at 3G, but it has not rotated ...
1
vote
2
answers
6k
views
Windows Apache logrotate.conf equivalent for rotatelogs.exe to overwrite logs
Our disk is getting full real fast on Windows with Apache Logs.I want to overwrite old log files so that there are only 10 files at any 1 time with a capacity of 5M each.
Is there a way to use rotate ...
0
votes
0
answers
812
views
logrotate problems after resetting mysql root password
A while ago, I had to reset my forgotton root password for mysql (strictly speaking mariadb) along a suitable how-to (might have been this
https://devanswers.co/how-to-reset-mysql-root-password-ubuntu/...
4
votes
1
answer
2k
views
Configuring NGINX for GDPR (= RGPD, DSGVO) compliance using anonymized IPs on older log files
The European General Data Protection Regulation Law (GDPR) aims to protect end users privacy. Among many other consequences, system administrators are therefore obliged to configure their systems in a ...
0
votes
0
answers
106
views
When appending to a file, does bash keep that file in memory
I have a long running python program that logs to a file.
I start program and let it run in the background
python my-process.py >> /var/log/my_log.log 2>&1 &
The free memory ...
0
votes
1
answer
386
views
Why "|| true" and >/dev/null expressions are so often used in logrotate postrotate configuration?
There are coutless examples of logrotate configs which contain the following:
postrotate
systemctl reload nginx 1> /dev/null 2> /dev/null || true
endscript
but what is the motivation behind ...
1
vote
2
answers
681
views
gzip softlocks every midnight during nginx log rotation, causes kernel panic
Some of our servers run on Ubuntu 18.10. They host a few Node.JS services receiving TCP connections as upstream from nginx, as well as a websocket implementation in Dotnet Core. It's a fairly simple ...
1
vote
1
answer
2k
views
logrotate prerotate script only fires for first log file, not all log files
We're using a prerotate script to upload our server logs to an S3 bucket in AWS. Here's the logrotate script:
/var/log/nginx/*.log {
daily
missingok
rotate 14
compress
...
0
votes
3
answers
8k
views
rotate logs with logrotate and move old files
Logrotate don't move file to oldlogs folder and exit abnormally with code 1.
I tried to launch manually it with -d option but no errors are showed.
This is my configuration:
/var/log/myfolder/*.log
{
...
2
votes
0
answers
490
views
Logrotate not rotating without size config
On RedHat, I have a logrotate configuration as follows :
/custom/path/kibana/logs/*.log {
missingok
daily
create 0644 suuser suuser
rotate 7
notifempty
sharedscripts
compress
dateext
...
0
votes
0
answers
169
views
Logrotate not removing the logs
I have the following logrotate script
/path/to/folder/*.logs {
daily
rotate 30
notifempty
sharedscripts
copytruncate
compress
dateext
preremove
if file --mime-type "$1" ...
1
vote
1
answer
403
views
The logrotate 'rotate' directive and migrating from daily to weekly
I have a server collecting syslog messages from the network. Logrotate is currently setup and working, and the config looks like such:
/logs/*/log {
daily
rotate 60
}
Instead of rotating ...
3
votes
1
answer
4k
views
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
{
...
2
votes
1
answer
490
views
Logrotate isn't deleting old files
I have a daily backup running using logrotate. I don't have root access to this machine to edit the normal logrotate.conf, therefore I'm calling it via crontab like so:
0 4 * * * /usr/sbin/logrotate /...