Questions tagged [logrotate]

A Linux tool for log files management. Do not use this tag for general questions about usage of logrotate and troubleshooting, but for programming questions related to logrotate.

Quoting the man page:

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.

469 questions
17
votes
1 answer

logrotate dateformat seems not supporting %H:%M:%S

I am newer to logrotate. when the configure comes to the property "dateformat",it seems that logrotate doesn't support strftime "%H" . here is the config: { daily rotate 2 size 3M missingok notifempty dateext dateformat…
gwecho huang
  • 579
  • 2
  • 6
  • 13
17
votes
2 answers

logrotate suffix: dateext + rotate

Is it possible to use dateext and rotate options at the same time? config must look like this: /var/log/verybig.log { monthly size=100M dateext dateformat .%Y%m rotate 5 create missingok compress } and i must…
strizhechenko
  • 408
  • 2
  • 6
  • 16
16
votes
2 answers

Forever log and logrotate

I use forever to launch my nodeJs server and I choose the log file : forever -l /home/api/log/api_output.log start server.js I use logrotate to move logfile every day (like advise here : NodeJS/Forever archive logs), after one day my directory is…
igor
  • 495
  • 1
  • 4
  • 16
16
votes
6 answers

logrotate cron job not rotating certain logs

I added two scripts in "logrotate.d" directory for my application logs to be rotated. This is the config for one of them: { compress copytruncate delaycompress dateext missingok notifempty daily rotate 30 } There is…
Ashok
  • 531
  • 1
  • 3
  • 12
14
votes
1 answer

Problems with permissions for logrotate

I'm writing my own logrotate configuration for some web application: /home/me/public_html/logs/*.log { daily missingok rotate 15 compress delaycompress notifempty create 0660 me www-data nosharedscripts } But running…
white_gecko
  • 4,808
  • 4
  • 55
  • 76
14
votes
2 answers

Does logrotate depend on cron?

in the logrotate manpage, they say: "Normally, logrotate is run as a daily cron job". Does that mean that logrotate uses cron (or is executed by cron)? If so, does that mean that if I don't configure a cron job via crontab (for instance), logrotate…
ling
  • 9,545
  • 4
  • 52
  • 49
14
votes
2 answers

logrorate: error: lines must begin with a keyword or a filename (possibly in double quotes)

I have the following logrorate config for my iptables: /var/log/iptables.log { daily missingok rotate 3 compress notifempty delaycompress postrotate /usr/sbin/service rsynclog restart >…
Erik
  • 14,060
  • 49
  • 132
  • 218
12
votes
2 answers

logrotate configuration file development and testing

I have two questions related to developing configuration files for the logrotate tool on Linux systems. When I make a change to a file in /etc/logrotate.d, do I need to somehow notify logrotate so that it will recognize and respond to the change?…
Randall Cook
  • 6,728
  • 6
  • 33
  • 68
12
votes
2 answers

How do I create a logrotate friendly file writer in Java or other platform?

What are the best practices for implementing a file writer/logger in Java that is compatible with logrotate? The goal would be allow logrotate to be used for all log management, instead of using built-in rotation/management of a logging API (Log4J,…
nbeyer
  • 1,157
  • 10
  • 14
12
votes
2 answers

Linux-Java logs rotating using log4j or logrotate.d

I have a Spring project using log4j on Linux (Debian, Ubuntu and RHEL). Now I would like to implement best practice logs rotation for the log4j generated logs. I have previously used logrotate.d for other non-java components and it worked great for…
hnviet
  • 1,747
  • 1
  • 18
  • 22
12
votes
4 answers

logrotate doesn't rotate catalina.out

I am trying to use logrotate to rotate out tomcat's catalina.out automatically on a daily basis even though I can manually call logrotate and it works fine. I am using I have tried every solution out there, but I cannot get it to rotate. I am on…
Justin
  • 1,356
  • 2
  • 9
  • 16
12
votes
3 answers

How to prevent logrotate from producing unwanted ".backup" files

I have a logrotate config on ubuntu 16.04 which is meant to rotate my logs to gz daily. The config is like so: /opt/dcm4chee/server/default/log/*.log { daily missingok rotate 5 compress notifempty create 0640 dcm4chee…
David Simic
  • 2,061
  • 2
  • 19
  • 33
12
votes
2 answers

How to force (or workaround) logrotate to move old logs to olddir on different physical disk?

I want logrotate to copy and truncate log file and use olddir on different physical disk. According to manual, olddir can't be on different physical disk because default behaviour of logrotate is to only rename original log file, which wouldn't be…
Frodik
  • 14,986
  • 23
  • 90
  • 141
12
votes
2 answers

Is there a difference between RotatingFileHandler and logrotate.d + WatchedFileHandler for Python log rotation?

Python has its own RotatingFileHandler which is supposed to automatically rotate log files. As part of a linux application which would need to rotate it's log file every couple of weeks/months, I am wondering if it is any different than having a…
devhallo
  • 337
  • 3
  • 13
11
votes
1 answer

log4j fileappender doesn't switch to the new file when logrotate rotates the log file

Context: I want to use log4j to write audit-related logs to a specific log file, let's say audit.log. I don't want to use syslogappender(udp based) because I don't want to be tolerant to data loss. Plus, I am using logrotate to rotate the audit.log…
Shengjie
  • 12,336
  • 29
  • 98
  • 139
1
2
3
31 32