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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
1k views

Issue : log-rotate is not working

I am configuring log rotation one of my production server. I am having a weired issue. I have configured the log rotation for a file on daily basis. But unfortunately the rotation is not working. I ...
4 votes
3 answers
10k views

How to combine logrotate with Log4j "rolling" file-appender?

We have a Java-application, that uses log4j and rotates its own logs daily: The currently-used log-file is /var/log/foo/foo.log It is moved into /var/log/foo/foo.log.YYYY-MM-dd when the day changes ...
5 votes
1 answer
9k views

logrotate: What means the message "log has been already rotated"

If I run logrotate I get log does not need rotating (log has been already rotated) and the log file is not rotated. Why that? My log rotate conf: /var/log/capp/*.log { missingok rotate 90 ...
1 vote
1 answer
1k views

Debugging logrotate postrotate script

Following is my logrotate conf. /mnt/je/logs/apache/jesites/web/*.log" { missingok rotate 0 size 5M copytruncate notifempty sharedscripts ...
1 vote
1 answer
2k views

Missing log rotations

One of my servers ran out of space recently. So I started looking into it. The nginx logs took half of the partition. Also, I noticed a strange thing. For a lot of sites (60%) extra rotations where ...
0 votes
2 answers
3k views

How should I rotate rsyslog documents stored in mysql

I have setup rsyslog to dump syslog data into mysql so that LogAnalyzer can easily access and interact with it. How do I automate a job to remove syslog data of a certain age for the mysql database ...
2 votes
1 answer
11k views

logrotate prerotate script not getting name of file to be rotated

I am having trouble with the prerotate script in logrotate 3.12.2. The script I specify in the prerotate/endscript section is not receiving the name of the file to be rotated as the first argument ($1)...
13 votes
2 answers
40k views

Logrotate not rotating file after file size exceeds the limit.

From logrotate manpage. It will not modify a log more than once in one day unless the criterion for that log is based on the log's size According to the man page, logrotate should rotate ...
1 vote
1 answer
659 views

What does the --force flag change about the behaviour of logrotate?

I am trying to find out why logrotate is only rotating a subset of logfiles in a folder when run without the --force flag. The man page for logrotate --force simply says: Tells logrotate to force ...
16 votes
2 answers
27k views

How can I rotate many log files into a different subdirectory per rotation?

I have a directory with many log files, all of which I would like to rotate daily. For organizational purposes I would like to be able to move the rotated logs into a different directory (or ...
9 votes
4 answers
7k views

Free-space driven log rotation on linux?

Someone just asked me 'how long should we keep logs for our application', and my answer was 'until the disk is full' as there's no reason to throw them away other than running out of space. However, ...
1 vote
1 answer
218 views

Strange log rotation using logrotate file

I have setup log rotation for postfix with a logrotate config file as follows: /var/log/mail.* { rotate 7 daily missingok notifempty delaycompress ...
1 vote
1 answer
928 views

Logrotate hourly will this restart my process

I'm looking at switching my log rotate setup to rotate logs hourly instead of daily. I think I've got the config ready to go but wanted to check whether the config would trigger a reload/restart of ...
0 votes
1 answer
490 views

Why doesn't logrotate's filename globbing pick up files with spaces in their names?

If I specify *bar* {} logrotate will match foo-bar.log but not foo bar.log. From what I have read, logrotate's globbing should behave like shell globbing, so to test I have run ls *bar*. However, ...
1 vote
0 answers
190 views

logrotate skipped a number in it's rotation... and then recovered?

I'm running an embedded system using a Yocto derived Linux distro. kernel version:4.1.15-2.0.0. We need to manage the logs and do so with logrotate. The requirements are that we have 72 hours of logs,...
1 vote
2 answers
896 views

MySQL replication & logrotate

I'm using MySQL Master-Slave replication for backup purposes (for a few days). Today after changing to expire_logs_days = 3 on master and slave I got this message (from slave): /etc/cron.daily/...
0 votes
0 answers
339 views

How to open multiple log files with less and logrotate?

I use logrotate for nginx and php logs. By default it names files like: access.log access.log.1 access.log.2.gz ... access.log.10.gz I want to open all of the log files in less so I can search ...
20 votes
1 answer
54k views

Linux: How to enforce specific permissions on newly created logs which are created by log rotate?

I've noticed that the mail logs which are being created in /var/log are being created and owned by root (user and group). I've written a Nagios check which monitors the log and in order to allow the ...
5 votes
4 answers
6k views

Daily Weekly and Monthly DB backup with logrotate?

I am currently keeping daily backup of my database by doing a daily mysqldump and by using logrotate to keep the 7 last days of mysqldump. I would like to improve this backup process to keep 7 daily ...
3 votes
2 answers
11k views

How does logrotate deal with copytruncate?

I understand that copytruncate is not an ideal setup, but that's the cards I'm dealt with... I have a service that is tailing data from journalctl and streaming it to a file. The setup to rotate the ...
18 votes
2 answers
60k views

Delete files with logrotate

Is it possible JUST to delete the log files in a directory by using logrotate w/o actually rotating them? We have an app that generates logs in the following format: app.log.DD_MM_YYYY. I am ...
2 votes
2 answers
2k views

error: error creating unique temp file: Permission denied

while executing logrotate script manually I am receiving an error as follows. $ logrotate -vf /apps/web/scripts/Logroate-web.conf truncating /apps/oracle/admin/mserver/adf12dev/servers/adf_1/logs/...
0 votes
1 answer
1k views

Logrotate Separate Policies in Same Directory

I am running rsyslog on CentOS and logrotate to rotate my logs. All hosts write their logs to /var/log/syslog/ in their own separate directory in this manner: /var/log/syslog/host1 /var/log/syslog/...
5 votes
2 answers
6k views

PHP-FPM signals for pool error_log rotation

I am moving all my server's log rotation tasks for logrotate. The server has several PHP-FPM pools, each of them configured with a separated error_log directive. The logrotate recipe for the logs is ...
2 votes
2 answers
2k views

systemd, logrotate and PID-files

I'm packaging some daemon for debian 8 and systemd. The daemon can create PID-file by itself, but it has no permissions to write into /run because of non-root user. It used to create PID-file via old ...
1 vote
1 answer
982 views

Log rotation not happening with cron job- files are symlinked and forceful log rotation works

I am facing issue with logrotation with 2 of my custom files. The folder where they reside - /var/log/test is symlinked to /sample/var/log/test cron.daily log which picks up logrotate: Sep 12 03:20:...
0 votes
1 answer
199 views

What does set logtarget Syslog 2 mean in logrotate.conf file?

I am using latest version of CentOS with NGINX. My Logrotate.conf file has two blocks/directives for fail2ban log (maybe it was a mistake by my previous hosting provider). Therefore, I am receiving ...
1 vote
1 answer
4k views

Logrotate Not Deleting Compressed Logs

I have a CentOS box running rsyslog and logrotate as my syslog server for a whole bunch of network devices. I've been toying around with this for a while, the logrotate/compression piece is working ...
0 votes
1 answer
617 views

MongoDB logrotate with occasional file size changed while zipping error

I use this script for rotating MongoDB v3.6.3 logs: /var/log/mongodb/mongod.log { weekly rotate 52 compress missingok notifempty sharedscripts ...
0 votes
1 answer
83 views

Daily Log Rotation - retaining original

I'm working on Ubuntu 14.04 hosting a graylog server. In the /var/log/upstart/ directory, I have a plaintext log of all the messages that come in - it's set to rotate every 3GB. However, the problem I ...
0 votes
0 answers
1k views

Does logrotate check diskspace before rotating a logfile?

I am trying to figure out how logrotate work regarding disk space but not able to figure it out? Scenario: Let say I have 2GB of the log file and free disk space is also 2 GB, does logrotate first ...
59 votes
4 answers
94k views

logrotate daily and size?

If a logrotate config is specified with "size" and "daily" parameters, which one takes precedence? Where is this documented? I would like these rotations to occur as a boolean OR operation, ie, if the ...
0 votes
0 answers
141 views

logrotate include more similar directories

I'm using logrotate for my apache access/error logs. I have many subdomains with the same configuration. /basedir/www/mysubdomain/logs So I programmed my logrorate with /basedir/www/*/logs/*.log { ...
2 votes
0 answers
75 views

What happens when svnserve gets stopped (SIGKILLED) while a commit is in progress?

What happens when svnserve gets stopped (SIGKILLed) while a commit [to an FSFS repository] is in progress ? (I mean has svnserve been made robust enough to handle this, say upon restart, or must the ...
0 votes
1 answer
3k views

Apache rotatelogs command is failing and apache doesnt restart [closed]

I have a command to implement rotatelogs for access logs of apache, but when I am trying to restart my apache server, it doesnt start and throws me an error in error.log as: The parameter is ...
24 votes
5 answers
51k views

rsyslog with logrotate: reload rsyslog vs copytruncate

I'm working on Ubuntu 14 with the default rsyslog and logrotate utility. In the default rsyslog logrotate /etc/logrotate.d/rsyslog config I see the following: /var/log/syslog { rotate 7 ...
0 votes
0 answers
231 views

Logrotate installed, settings for nginx duplicated between two servers...but different log file sizes

I have two web servers, using nginx, I have logrotate installed on both, and the settings for both logrotate.conf and logrotate.d/nginx are both the same. Both store logs in /home/websitename/.pm2/...
22 votes
5 answers
27k views

Logrotate: Rotating non-log files?

I have a backup script that compresses various files and directories and creates .tgz archives. Files are named, e.g. ... backup_2010-10-28.tar.gz backup_2010-10-29.tar.gz backup_2010-10-30.tar.gz ...
2 votes
2 answers
742 views

Any good reason not to use date-based logfile rotation (rdiff-backup)?

rdiff-backup is a really nice tool for backing up Linux servers. One problem, though, is logrotation: Since rdiff-backup doesn't know how to detect renamed files, every daily backup contain a ...
3 votes
1 answer
7k views

Logrotate postrotate: Log file name variable empty

According to the logrotate manual (https://manpages.debian.org/jessie/logrotate/logrotate.8.en.html), logrotate should invoke a script and hand over the filename of the rotated file as the first ...
3 votes
1 answer
3k views

Elastic Beanstalk Log Rotation Causing Apache Restart

I have already worked through AWS Elastic Beanstalk - Apache is restarting constantly Our elastic beanstalk instances are reporting the following message in the error_log [Mon Jun 26 22:01:01....
2 votes
2 answers
2k views

How does one keep a file's timestamp (date modified) after a logrotate?

Title says it all, I have a log rotate set up daily for some rather large log files. Sometimes we can generate 3 of these a day, sometimes we only generate 1, they're each about 500MB. Is there a way ...
1 vote
2 answers
2k views

Some logs rotated to log.1 some to log.1.gz

Some files are zipped to 1.gz /var/log/apt/history.log.1.gz /var/log/apt/term.log.1.gz /var/log/mosquitto/mosquitto.log.1.gz /var/log/mysql/error.log.1.gz Some are not zipped, first the second level ...
3 votes
2 answers
3k views

make logrotate to only rotate at service startup

I'd like to do logfile rotation for whenever i start a service, but never "automatically". I'm running a python-based service that logs to a specific logfile. the service (currently) does not support ...
11 votes
3 answers
21k views

Why does my CentOS logrotate run at random times?

I put a logrotate configuration file in /etc/logrotate.d/ and expected the logs to rotate at a consistent time; however, they do not... log rotation times are seemingly random +/- one hour. Why are ...
1 vote
1 answer
552 views

SELinux denies "systemctl kill" when used in Anacron postrotate script on CentOS 7

I'm using backup software called UrBackup, which I've configured to rotate its logs once a day through cron.daily. After the logs are rotated, the software uses a postrotate script to send the running ...
3 votes
0 answers
3k views

How to setup logrotate properly for multiple systemd services, which sends their stdout, stderr to rsyslog

Suppose I have many systemd service units on ubuntu 16.04 which looks like this: [Unit] Description=Do something script After=default.target [Service] ExecStart=/usr/local/sbin/some-script-x.sh Type=...
3 votes
4 answers
4k views

Logfiles go blank after logrotate rotates them

I have an ubuntu 8.04 LTS server that runs openvpn. The openvpn server writes to a standard logfile under /var/log and prior to a month ago logrotate would automatically rotate the files and compress ...
1 vote
2 answers
3k views

Mongo forcing a log rotation on Windows

I was wondering how I can setup log rotation for a MongoDB on Windows. I'm only reading it for Linux and Unix based systems in the documentation. Does anyone know how I can set this up? https://...
24 votes
7 answers
15k views

Continuously monitor logs with tail that are occasionally rotated

We're using tail to continuously monitor several logs, but when a log is rotated the tail for that file will cease. As far as I understand, the problem is that when the log is rotated, there is a new ...

1 2 3
4
5
9