2022 Developer Survey is open! Take survey.

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
1 answer
18 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 ...
user avatar
0 votes
0 answers
19 views

Logrotate - specify weekly run in separate config file, but is not rotating

Objective: weekly rotate haproxy.log, written by rsyslog Docker container. Scenario: Running an application with Docker-based HAProxy containers, each proxy sends logs to a Docker rsyslog container, ...
user avatar
  • 467
1 vote
0 answers
75 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 /...
user avatar
0 votes
1 answer
18 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 ...
user avatar
0 votes
1 answer
20 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 ...
user avatar
0 votes
1 answer
48 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 ...
user avatar
0 votes
0 answers
16 views

How does missingok behave in case of a directory specified in case of a single file?

Logrotate missingok states: You can ignore the error message when the actual file is not available. Like in the below example - /tmp/output.log { size 1k copytruncate rotate 4 ...
user avatar
1 vote
1 answer
51 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 ...
user avatar
0 votes
1 answer
156 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,...
user avatar
0 votes
2 answers
44 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 ...
user avatar
0 votes
1 answer
15 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? ...
user avatar
0 votes
1 answer
50 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 ...
user avatar
0 votes
0 answers
59 views

logrotate files automatically

I need to logrotate a filed hourly, so i did the following: vim /etc/logrotate.hourly.conf /var/log/tomcat/* { hourly create 0600 root root rotate 5 size 100M olddir /mnt/ho ...
user avatar
  • 1
0 votes
0 answers
46 views

logrotate for custom logfile

I have a some kind of python/bash script. This script logs some infos to the output file. I want to do rotating this outputfile. This is my script #!/bin/bash while : do date +"%d.%m.%Y %...
user avatar
0 votes
1 answer
134 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 ...
user avatar
0 votes
0 answers
19 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. ...
user avatar
0 votes
0 answers
147 views

Can I use log rotate to archive files older than 7 days, and delete tar files older than 15 days

Basically, what the title says. I'm currently using a combination of logrotate and separate scripts to try to get this behavior, but I would very much like to get everything centralized under ...
user avatar
  • 133
1 vote
1 answer
74 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 ...
user avatar
  • 4,225
0 votes
1 answer
48 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' ...
user avatar
  • 2,243
0 votes
0 answers
30 views

How to save file permission in logrotate process

I want to rotate some log files but I don't want to create a new file. I want my original log file remain exactly as same as before. My conf_file is like this: /path to log file/{ } It's working, ...
user avatar
  • 21
0 votes
1 answer
31 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 ...
user avatar
0 votes
0 answers
26 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 ...
user avatar
  • 1
0 votes
1 answer
71 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 ...
user avatar
  • 10.9k
0 votes
2 answers
742 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 ...
user avatar
  • 10.9k
0 votes
0 answers
106 views

Use logrotate to aggregate multiple log files into one compessed file

The program logrotate is very useful when it comes to zipping away a log file that is getting bigger and bigger. Is it possible to edit/zip multiple files to one file with Logrotate? Example: ...
user avatar
  • 1
0 votes
0 answers
12 views

Is it safe for multiple VMs to logrotate a same network drive

We are revamping and my proposed setup is as follows: Multiple VMs (Instances will scale up and down) on cloud A share network drive (SMB) for storing some logs We want to use logrotate to house keep ...
user avatar
0 votes
1 answer
955 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 ...
user avatar
0 votes
0 answers
129 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. ...
user avatar
  • 6,657
1 vote
1 answer
215 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 ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
3 votes
1 answer
856 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 ...
user avatar
  • 10.9k
0 votes
0 answers
73 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 ...
user avatar
  • 434
1 vote
1 answer
57 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,...
user avatar
  • 113
0 votes
1 answer
2k 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?
user avatar
0 votes
1 answer
273 views

Using openrc and using logrotate causes logging to stop working using Alpine Linux

I'm using a very vanilla openrc service to run a Go application I wrote that spits out logging data to stdout which was working perfectly fine before I enabled logrorate on my application's log files. ...
user avatar
  • 101
0 votes
1 answer
359 views

logrotate not splitting log file

I am trying to get logrotate to work on my OpenResty server logs. My logrotate configuration file /etc/logrotate.d/openresty should execute daily which is default behavior and I'm trying to run it ...
user avatar
  • 133
0 votes
1 answer
187 views

Modify logrotate defaults on Ubuntu

Ubuntu 18.04 has default configurations of packages for logrotate in /etc/logrotate.d For example with nginx installed I have a file /etc/logrotate.d/nginx /var/log/nginx/*.log { daily ...
user avatar
  • 4,841
0 votes
0 answers
79 views

Aws Ubuntu instance with ebs volume has run out of disk space?how to clear any unwanted files which clear disk space

I am running many python process as services under SystemD. The count could exceed 200 python system services which i found using the below command systemctl list-units --type=service | grep "...
user avatar
5 votes
2 answers
2k views

How to properly logrotate logs of service managed by systemd via `file:` config

I have a service managed by systemd that has the following systemd config telling systemd to write the logs to a file directly (no syslog or anything) StandardOutput=file:/var/log/foo/my.log I have a ...
user avatar
  • 153
0 votes
0 answers
73 views

logrotate script for xinetd postrotate

I need help with rotating my xinetd.log file. I'm using CentOS8 and I have this logrotate file: /var/log/xinetd.log { compress dateext daily rotate 7 missingok copytruncate ...
user avatar
  • 41
0 votes
0 answers
106 views

internal logrotate mechanism in syslog-ng

Does the syslog-ng has its own rotating mechanism? I am new to auditing and linux and I though I could use logrotate but I noticed that I need to restart the syslog-ng daemon every time when I use it ...
user avatar
2 votes
1 answer
879 views

Adjust logrotate to use xz for logs

On a current Debian Testing machine, I am wanting to use xz to compress log files instead of GZip. It has higher compression out of the box, and as such I wish to use it. However, whenever I specify ...
user avatar
  • 2,340
1 vote
1 answer
462 views

Bash script to split logs based on file size

I'm working on a .bash script that kicks off a Java program, logs the sysouts to an 'outfile', then appends the log results for historical purposes to a 'archive' zip. My current script is like below.....
user avatar
  • 153
1 vote
1 answer
763 views

auditd not compressing logs during rotation

Audit is not compressing any logs. Perhaps this is a config issue. Could you perhaps tell me what's causing this in the below config? local_events = yes write_logs = yes log_file = /var/log/audit/...
user avatar
  • 553
0 votes
2 answers
59 views

logrotate: what counts as rotation? single files or single executions?

Let's ipothize I've a directory with 2 logs access.log error.log My logrotate is configured for daily rotation with 10 as rotation My question is: will I end up with 20 files or with 10 files ?
user avatar
  • 541
0 votes
1 answer
54 views

Why am I still seeing old log files and not having new ones?

This is my setting logrotate /home/sy/logs/kitxit*/*/tend.log { daily rotate 10 dateext compress delaycompress copytruncate missingok ...
user avatar
  • 3
0 votes
1 answer
119 views

Linux logrotation file showing incorrect size than usual

I have enabled logrotation under springboot directory and it is working but what i see is, "content-data-svc.log" is actually 2MB but when i do ls -ltrh it is showing as 61MB. if i view the log file,...
user avatar
1 vote
0 answers
947 views

logrotate is not working in RHEL7

I have enabled below log rotation on my VM but still logs are not getting rotated for next day, still I see logs are appending in 1 log file. What I actually need is, imagine a service got started ...
user avatar
0 votes
0 answers
285 views

logrotate not working properly

I'm trying to setup logrotate but for some reasons logrotate isn't rotating the files. It always complains that it cannot find previous log files. Below the content of my logrotate file: /home/cm/...
user avatar

1
2 3 4 5 6