Skip to main content

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
1 vote
1 answer
21 views

Understanding Log Management on a Linux Server

I'm trying to get a better understanding of how log management works on a Linux server. When I install a Linux server, I notice that there are many log files and directories in /var/log. My concern is ...
Allan Xu's user avatar
  • 109
2 votes
1 answer
41 views

Shell/bash: Can I create a file descriptor to an existing file without emptying the file? [duplicate]

Context: I have cursory bash experience. I do not fully get file descriptors, just some basic usage. Trying to create a setup script. Most done, but a few "kinks" remain. So here is a newbie ...
Marcus Widerberg's user avatar
-1 votes
1 answer
20 views

logrotate not working as per configuration provided

I am working on a java application running in Ubuntu Server (16.04) which copies log files from certain folders and consolidate then when user closes the session. In ubuntu server rsyslog filters and ...
Amudhan R's user avatar
0 votes
1 answer
38 views

How to fix "error setting owner of a.s to uid 0 and gid 0" without sudo

This is related to another question on logrotate qs1. When running the command logrotate /etc/logrotate.d/test, I am also getting a error: error setting owner of /var/lib/logrotate/status.tmp to uid ...
brokendreams's user avatar
0 votes
1 answer
182 views

How to logrotate official nginx docker image running by podman

I started official nginx image in podman under root with command: sudo podman run --name nginx \ ... \ -v /var/log/nginx:/var/log/nginx \ docker.io/library/nginx:latest Logging working ok, but ...
Almaz's user avatar
  • 153
0 votes
0 answers
27 views

How does option overwriting work with logrotate?

From the manual: Each configuration file can set global options (local definitions override global ones, and later definitions override earlier ones) and specify logfiles to rotate. If I understand ...
Jon's user avatar
  • 1
0 votes
1 answer
87 views

logrotate create one compressed archive from log files with different file names

I have a log folder under under /var/USER/mylogs and there on a daily basis log files in format "DATE-mylogile.log". DATE is formatted as "%d-%m-%Y". So in my folder i have for ...
Opa114's user avatar
  • 101
0 votes
1 answer
67 views

logrotate "postrotate" configuration

Below are 2 identical examples of logrotate configuration, the only difference is the postroate block where the second example is missing the >/dev/null 2>&1 || true /var/log/nftables.log { ...
metablaster's user avatar
0 votes
0 answers
23 views

logrotate behave unusually, how do I debug?

/path/to/logs/*.out { su server server daily copytruncate missingok rotate 7 compress dateext dateformat -%Y-%m-%d } /path/to/logs2/*.log{ ...
achhainsan's user avatar
0 votes
1 answer
313 views

Logrotate without root user access not working

The problem is that we don't have EASY root access to servers. That's why being able to run logrotate without being root is very handy. This is what I did after following articles on the internet. ...
achhainsan's user avatar
0 votes
1 answer
162 views

Unison, systemd and logrotate

I have unison running under systemd to keep my local and remote NASs in sync. The systemd config is thus: [Unit] Description=NAS Unision service After=network.target StartLimitIntervalSec=0 [Service] ...
Dobbo's user avatar
  • 124
1 vote
1 answer
274 views

Correct config to delete files after 7 days?

Is this the correct config to delete files after 7 days using logrotate? It should rotate weekly. I'm pretty stumped on this one. Thanks. /var/lib/rundeck/logs/rundeck/*/job/*/logs/*.blah.json { su ...
Gru's user avatar
  • 13
0 votes
0 answers
105 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
62 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
24 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
70 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
361 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
472 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
77 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
1 answer
96 views

How can I have rotated log files without a numbered suffix using 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
1 vote
1 answer
1k 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,331
0 votes
1 answer
430 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
  • 127
0 votes
1 answer
46 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
1 answer
798 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
  • 341
0 votes
1 answer
320 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
  • 511
0 votes
1 answer
82 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
868 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,811
0 votes
1 answer
1k 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
3 votes
2 answers
1k 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
115 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
2k 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
131 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
2k 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
1 vote
1 answer
1k 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
3k 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
2k 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
569 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
45 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
305 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
2k 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
718 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,821
0 votes
2 answers
335 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,549
0 votes
1 answer
369 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
301 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
291 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
  • 13.4k
0 votes
2 answers
5k 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
  • 13.4k
0 votes
1 answer
6k 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
784 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,619
1 vote
1 answer
1k 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

1
2 3 4 5 6