Questions tagged [logrotate]

logrotate is a program which is scheduled (usually nightly or weekly) to archive log files by renaming them with a suffix so that the applications writing the log files start writing to new (empty) files.

Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

Using maxage in conjuction with rotate in logrotate?

I've read these blogs about maxage and rotate when used in conjunction and I'm still confused about it. https://www.clearos.com/clearfoundation/social/community/silly-question-re-logrotate-and-rotate-...
achhainsan's user avatar
-2 votes
1 answer
33 views

When wildcard is used in logs directory, what does the size tell? The size of 1 log or the total size of all the logs?

https://www.keycdn.com/support/logrotate#maxsize This limits each log file's size to the specified number of bytes /var/log/nginx/*.log { size 50G } Does the 50G size here means the size of all the ...
achhainsan's user avatar
0 votes
0 answers
9 views

Logrotate --debug is pulling status from alternate locations

Here is my config file: /path/to/somelog.log { daily copytruncate compress delaycompress nocreate missingok rotate 7 dateext dateyesterday dateformat _%Y-%m-%d-%...
Tony Sherwood's user avatar
0 votes
1 answer
45 views

How to automatically change the name of a file on a daily basis

I am new to Linux/CentOS and right now I am running into a little problem. My CentOS7 Server logs all Maillogs on a daily basis and moves them to the folder /var/log/old_maillogs. Right now the logs ...
Moritz's user avatar
  • 3
0 votes
0 answers
66 views

auth.log file in bullseye os

I have debian gnu/linux 11 (bullseye), in which the /var/log/auth.log file only contains log of current boot and not any previous boots, I need it to store the logs of previous boot for verifying the ...
Jay K's user avatar
  • 1
0 votes
0 answers
81 views

logrotate not as expected

I have a logrotate service configured as below running on a user systemd timer. The issue is that the target of the rotate is allowed to grow beyond the size specified in the logrotate.conf, and that ...
Stephen Boston's user avatar
0 votes
1 answer
143 views

Move compressed log files outside /var/log [logrotate with log2ram]

I am looking for advice about logrotate. I have recently installed log2ram to spare my ssd. Since I was not using all 24Gb RAM I assigned 2Gb to /var/log/. currently +- 300Mb is used. I would like ...
Vincent Stans's user avatar
0 votes
1 answer
71 views

List of systems that are sensitive to file permissions

I ran into an issue on my NAS where I mistakenly reset the permissions on the root file tree to 664. This ended up disrupting many of the NAS functions, like ssh and, after much debugging, logrotate. ...
infojunkie's user avatar
0 votes
0 answers
28 views

Linux logrotate

I have on my server more file rotate, but when I want to compress it, i Have an extension 1.gz, but I just want .gz These files are automatically rotate by the application: server.log.2023-03-16 ...
sam's user avatar
  • 1
0 votes
0 answers
19 views

log rotation improper

I have a log rotation script for audit.log as below, where I found as per the script, instead of rotating of log for every 512MB, it is rotating every 1 hour exactly, however, the 8 log files are ...
xrkr's user avatar
  • 269
1 vote
1 answer
420 views

How to delete old log files with logrotate

In my CentOS, there is a Logstash, which generate many log files. Here is how the log files look like: logstash-2023-03-09.log logstash-2023-03-20.log logstash-deprecation-2023-03-...
Yves's user avatar
  • 3,181
0 votes
1 answer
128 views

How many times will postrotate run when defining logrotate for multiple directories?

I have the below configuration for rotating the DB backups. The /var/mysql_backup/data/ contains two subdirectories db1 and db2. /var/mysql_backup/data/*/db.sql.gz { daily rotate 7 ...
Niyaz's user avatar
  • 117
0 votes
0 answers
138 views

How do I set permissions of compressed log files using Logrotate's "create" config option?

My client can't access the compressed logfiles because of their set permission. I was expecting that Logrotate's "create" config option would solve this by setting the compressed output ...
user avatar
0 votes
1 answer
42 views

Discrepancy between size of log file and space reported by df on CentOS 6.6

I have a log file on a CentOS system that is taking up 700MB of space (seen using ls), but when I run the df -h command, it shows that only 200MB of space is being used on the file system (ext4). What ...
julesl's user avatar
  • 103
0 votes
0 answers
84 views

Is this an efficient way to rotate log files for vmware-vmsvc and vmware-vmsvc -root on a specfic server?

I seem to have a lot of large log files called vmware-vmsvc and vmware-vmsvc-root in my var/log folder. I've been told that if I just delete them they will only get recreated..is there a best way of ...
Mick8695's user avatar
  • 101
0 votes
0 answers
339 views

Can logrotate automatically track the size of the log file and rotate it when its size exceeds the limit?

I saw the size directive and created the configuration file /etc/logrotate.d/test: /home/user/log1 { size 100 rotate 3 compress } but it doesn't work as I expect. The file should be ...
ibse's user avatar
  • 257
0 votes
0 answers
83 views

What is the meaning of last field in logrotate.status file?

Let's say that I have the following line in logrotate.status file: "/var/log/cron" 2022-11-27-0:0:1 If I have the following files: ls -l /var/log/cron** -rw-------. 1 root root 41998 dic 2 ...
sebelk's user avatar
  • 4,219
0 votes
0 answers
298 views

Rotate nginx logs by size

I want to rotate nginx logs when they reach 10MB. Below the config that I have: /usr/local/nginx/*.log { size 10M daily missingok rotate 5 compress ...
anvd's user avatar
  • 121
0 votes
1 answer
178 views

Trying to rotate logs however tee command fails to return after execution

My logs nohup.out is owned by root user while I m trying to rotate the logs using system which has privileged access using sudo I have written the below script to rotate logs. cat rotatelog.sh cp /var/...
Ashar's user avatar
  • 459
0 votes
1 answer
63 views

Log rotate is not working when set 2 jobs in the same time

Hi i have directory where i keep logrotate configs. Let's say /directory1/scripts/logrotate/logrotate_1.conf All of them are similar. logrotate_1.conf su root root /zzz/env/yyy/tomcat/logs/catalina....
Kamil Sz's user avatar
0 votes
0 answers
431 views

Is Logrotate missing from my Cron?

I just discovered that my Raspberry Pi has been running out of memory. Checking the contents of /var reveals that I had rather large log files in it (cd /var; du -h | sort -h): 1.3G ./log/journal/...
P A N's user avatar
  • 1,691
0 votes
1 answer
642 views

How do I keep latest 4 backup file and delete the older one

How do I keep the latest 4 backup files and delete the older one? backup-Y-M-D.zip backup-Y-M-D.zip backup-Y-M-D.zip backup-Y-M-D.zip . . backup-Y-M-D.zip There are about 80 files having .zip ...
Siddharth Jain's user avatar
1 vote
1 answer
608 views

Tomcat logrotate error: tomcat:1 bad rotation count '7 compress missingok size 5M }'

I have a standalone Tomcat installed on CentOS 8 and I am trying to rotate the catalina.out file. I have created a file named /etc/logrotate.d/tomcat with vim and added the following line: /opt/...
user518510's user avatar
0 votes
1 answer
90 views

What should be the equivalent logrotate script for CentOS 8

I have a logrotate script for some of my log files at our Ubuntu server. The script is give below. /home/*/logs/*log { su root root notifempty daily rotate 7 ...
Hasanuzzaman Sattar's user avatar
1 vote
0 answers
742 views

logrotate not compressing files

I'm having issues with logrotate as it does not compress files. We migrated from Centos 7 to Alma linux and since it has not worked. I'm trying to get logrotate to rotate and compress log files from /...
networkz's user avatar
0 votes
1 answer
73 views

Understanding log rotate configuration

I'm having difficulty understanding this logrotate file. Please correct me if I'm wrong /var/log/app-logs { daily rotate 7 maxage 7 dateext compress ...
user89978's user avatar
0 votes
1 answer
963 views

Logrotate scenarios - Mix and match cron.daily and daily directive

The file: /etc/cron.daily/logrotate has the following statement: /usr/sbin/logrotate /etc/logrotate.conf The logrotate.conf file has the weekly directive defined inside. Now I have two rotational ...
Dawson Smith's user avatar
0 votes
1 answer
620 views

What should be the preferred approach while rotating logs - using the daily directive or putting the file path in cron.daily? [closed]

While doing log rotation, we have two options - Using the daily directive in the logrotate file - /var/log/wtmp { daily minsize 1M create 0664 root utmp rotate 1 } Putting the ...
Dawson Smith's user avatar
1 vote
1 answer
2k views

How do ifempty and notifempty work in case of size parameter defined in case of logrotate?

Suppose if I have a logrotate command like this /a/b/file.log{ size 5M ifempty } Now the logrotate works on the condition that size should be more than 5MB and then logrotate will start working for ...
Dawson Smith's user avatar
0 votes
1 answer
1k views

error: error setting owner of a.s to uid 0 and gid 0: Operation not permitted

While running the command /usr/sbin/logrotate /etc/logrotate.d/applogrotate. I get the error error: error setting owner of a.s to uid 0 and gid 0: Operation not permitted. Inside the applogratate file,...
Dawson Smith's user avatar
0 votes
2 answers
399 views

Understanding the difference between rotate alone and rotate with compress in logrotate

The below block has no compress statement - /a/b/file.log{ size 200M create 0664 root root rotate 10 datext dateformat -%Y-%m-%d-%s } This one has a compress statement - /a/b/file.log{ size 200M ...
Dawson Smith's user avatar
0 votes
1 answer
34 views

Logrotate command block explanation

I have the following logrotate command block - /a/b/file.log{ size 200M create 0664 root root rotate 10 compress datext dateformat -%Y-%m-%d-%s } Can someone elaborate the meaning of the above block? ...
Dawson Smith's user avatar
1 vote
1 answer
239 views

Difference between files cat /etc/logrotate.conf and cat /etc/logrotate.d and cat /etc/cron.daily/logrotate

I am new to logrotate. I am seeing three files /etc/logrotate.conf and /etc/logrotate.d and /etc/cron.daily/logrotate which are essential to the logrotate functioning. But I'm not able to understand ...
Dawson Smith's user avatar
0 votes
1 answer
1k views

logrotate not able to truncate catalina.out - actual answer

This is related to logrotate not able to truncate catalina.out which is incorrectly closed as a duplicate, even though the duplicate question describes a subtly different issue with a very different ...
Kevin Keane's user avatar
0 votes
0 answers
20 views

What files should be deleted if i don't want anyone to know if the system has been once linked to the internet?

For certain reasons I have to delete all files that might indicate that the syatem has once been linked to the internet. I have deleted all the records in browser, and the internet ethernet address. ...
ZHANG Juenjie 's user avatar
1 vote
1 answer
400 views

Postfix thinks its on a read only filesystem?

I want to run some analytics on my mail.log (postfix 3.2.13 on Ubuntu 20.04 LTS) including updating a db of undeliverable emails, so I wrote script, excluded mail.log from the generic /var/log ...
symcbean's user avatar
  • 5,110
0 votes
2 answers
189 views

What is adding a date suffix (access.log.20210909.gz) not the default for logrotate, instead of changing filenames every time (.1, .2.gz, .3.gz)?

Why is the simple solution "adding a datetime suffix to log filenames, e.g. access.log.20210909.gz" not logrotate's default behaviour? Rather than doing a renaming of all log files' ...
Basj's user avatar
  • 2,361
0 votes
1 answer
181 views

logrotation is gziping log files with incorrect format

I have enabled below logrotation on my VM but somehow logs are being gziped with incorrect format. log rotation /logs/springboot/*.log* { missingok minsize 100M copytruncate ...
Surendar 's user avatar
0 votes
0 answers
203 views

How to avoid multiple sequence numbers with logrotate

I want to use a central syslog-server (Ubuntu 20.04) to collect log events from other linux servers. This is the logrotate.d config file I use: rotate 90 daily missingok nocompress dateext dateformat ...
Jeff's user avatar
  • 1
0 votes
1 answer
256 views

how to check validity of /etc/logrotate.d/syslog

we want to check the validity of the configuration file /etc/logrotate.d/syslog and that because we made some changes on that file from our bash script so we use the following approach to check the ...
yael's user avatar
  • 12.7k
0 votes
2 answers
3k views

logrotate + how to control the secure logs under /var/log

secure logs under /var/log in our server are more then 1G as the following du -sh * | grep sec 0 secure 4.2G secure-20210726 1.8G secure-20210801 1.2G secure-20210804 so we decided to ...
yael's user avatar
  • 12.7k
0 votes
1 answer
4k views

Have SELinux allow syslog and logrotate to handle files outside of /var/log

on a Centos 8 server, I attached a bigger disk mounted to /mnt/data. The server runs rsyslogd which has a policy to write logs from external systems to /mnt/data/logs/$HOSTNAME. I do now have the ...
Markus Schulze's user avatar
0 votes
0 answers
540 views

How can I force nginx to start a new access.log file?

I have to grep through nginx access logs to nullroute troublesome IP addresses regularly, in my estimate about every 15 minutes, and I may have to do whole blocks instead of just the individual IPs. ...
vfclists's user avatar
  • 7,235
1 vote
1 answer
772 views

Logrotate says it rotates but does not

I have a strange issue with logrotate on a Raspbian 9 system. Logrotate appears to be configured to rotate /var/log/syslog every seven days. When I run logrotate -f -d /etc/logrotate.conf the output ...
Christian's user avatar
0 votes
0 answers
184 views

How to logrotate in any user dir as user?

We have one file, need to timestamp it and archive it in order to prevent overwrites. Solution must work in any user directory. Solution must be foolproof. Solution should work without superuser ...
user894319twitter's user avatar
0 votes
1 answer
169 views

Is it safe to change logrotate rotate config? Any risk of old logs being deleted?

I'd like to change the config of rotate 16 to rotate 104 for a logrotate config. Is this a safe operation? Can it potentially mess up the order / loose log entries? Yes I can and should make backups ...
Chris Stryczynski's user avatar
4 votes
1 answer
3k views

dmesg + how to enable dmesg history logs

We have RHEL server version 7.2 and we noticed that dmesg files from previous sessions under /var/log are not created what we have under /var/log are only ls -ltr | grep dmesg -rw-r--r-- 1 root ...
yael's user avatar
  • 12.7k
0 votes
0 answers
325 views

Logrotate rotating one hour after log creation instead of on the hour

I have the following logrotate config that I want to use to rotate a log hourly. It works but I noticed that instead of logrotate rotating on the hour (e.g. 13:00, 14:00), it seems to rotate an hour ...
sjaak's user avatar
  • 564
1 vote
1 answer
527 views

Getting name of logrotate file?

Let me start by saying I'm very new to linux and bash scripting, only been at this for 2 weeks so assume I know nothing! For development reasons, I need to copy a log file to another location and name,...
Phaelax z's user avatar
  • 113
0 votes
1 answer
6k views

after editing logrotate file do I need to restart something?

After editing /etc/logrotate.d/rsyslog do I need to restart some service before it takes effect?
Roger Mungo's user avatar

1
2 3 4 5 6