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.

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.

Normally, logrotate is run as a daily cron job. It will not modify a log multiple times in one day unless the criterium for that log is based on the log’s size and logrotate is being run multiple times each day, or unless the -f or -force option is used.

Any number of config files may be given on the command line. Later con- fig files may override the options given in earlier files, so the order in which the logrotate config files are listed in is important. Nor- mally, a single config file which includes any other config files which are needed should be used. See below for more information on how to use the include directive to accomplish this. If a directory is given on the command line, every file in that directory is used as a config file.

If no command line arguments are given, logrotate will print version and copyright information, along with a short usage summary. If any errors occur while rotating logs, logrotate will exit with non-zero status.

AUTHORS

   Erik Troan 
   Preston Brown 
436 questions
0
votes
0 answers

inside nginx custom docker image, cron service is running but not the jobs executing

Dockerfile of nginx container FROM nginx:latest # Remove sym links from nginx image RUN rm /var/log/nginx/access.log RUN rm /var/log/nginx/error.log RUN apt-get update && apt-get install -y logrotate && rm -rf /var/lib/apt/lists/* COPY nginx.conf…
0
votes
0 answers

logrotate is not working correctly

apache : 2.4.29 My requirement is that error_log needs to rotated and error_log needs to have the latest log, error_log.1 should have logs older than error_log and error_log.2 should have logs older than error_log.1 and so on. But the problem is…
0
votes
0 answers

mysqldump in postrotate fails with automatic rotate

I have this simple logrotate script /var/backups/mysql/wordpress.sql.gz { rotate 7 daily sharedscripts missingok nocompress postrotate /usr/bin/mysqldump wordpress | /usr/bin/gzip >/var/backups/mysql/wordpress.sql.gz …
flm
  • 101
  • 2
0
votes
2 answers

Logrotate group of files if any member is eligible

I have a group of log files (they are related but that's application level and not relevant). I want to set up logrotate configuration on Debian linux to rotate the whole group (all the files) once any of them reaches the limit, say 100MB for…
wick
  • 147
  • 1
  • 10
0
votes
1 answer

Nginx doesnt' log into access.log

I'v been struggling with Nginx logging. A problem that I found out first was logrotate failure. so I've changed user to the same owner of nginx worker process which is www-data and I forced logrotate, then It suddenly stopped to log. here's the…
Taylor
  • 1
0
votes
0 answers

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 nocompress notifempty missingok create 640…
Niyaz
  • 113
  • 5
0
votes
0 answers

logrotate works manually but not works automatically via cron on Ubuntu 18.04

I have a logrotate task to rotate my nginx logs. I have my config file in /etc/logrotate.d/nginx. When I run logrotate -f /etc/logrotate.d/nginx, it can rotate the logs correctly, which means my config file is corrent. By when I put the command in…
Hank Chow
  • 111
  • 2
0
votes
0 answers

selinux file context precendence, logrotate and httpd

UPDATE: figured out the issue, its with my fcontext path expression I have to use semanage fcontext -a -t logrotate_tmp_t "/etc/httpd/logs(./*)?" instead of semanage fcontext -a -t logrotate_tmp_t "/etc/httpd/logs/*" and -t httpd_log_t also…
0
votes
0 answers

rsyslog is not capturing logs from remote server post log rotation

I have configured the rsyslog on my CentOS-7 server to receive logs from a network device. And, it is receiving logs at the configured file path. But, when the logroatation is done, it creates a new file and zip the existing log file as configured.…
Sophie
  • 1
0
votes
0 answers

Can run daily logrotate without cron?

On my docker, i use amazonlinux:2 at this default enviroment not install cron. I want to use logrotate for rotating log of application every daily. Can Logrotate work automatic without cron? This file /etc/logrotate.d/app_log /home/app/logs/*.log { …
0
votes
1 answer

apache in docker: best practice to manage logs written to mounted volume?

What the best practice to write and manage log files written by Apache HTTPD running in a container? We run Apache HTTPD using docker base image httpd:2.4-bullseye. Right now HTTPD is configured to write its logs to stdout and stderr. Docker…
chrisinmtown
  • 101
  • 4
0
votes
0 answers

Logs are not shifting to new directory after log rotation

I am facing issue. We have setup log forwarder for sentinel and logs are frequently coming on /var/log/messages. Actual problem is i have created one script for log rotation and placed it under /etc/logrotate.d/ with name messages.conf below is the…
0
votes
1 answer

How to properly configure a custom logrotate configuration file?

For the first time today, I am trying to write a configuration file for logrotate. When I restart the logrotate service, I get the following error: logrotate.service: Failed with result 'exit-code'. If I delete my file and restart logrotate.service,…
theirman
  • 1
  • 2
0
votes
0 answers

How to avoid data loss during log rotation in linux/kubernetes?

Brief We are running our workloads in kubernetes on AWS EKS. All our applications write the logs in /var/log/app_logs directory using hostPath. (yes it's not a best practice, this is due to legacy codebase, eventually we want to move to…
dm90
  • 101
  • 3
0
votes
1 answer

What is the default configuration for logrotate.conf in Ubuntu?

In /etc/logrotate.conf is user permission different from one ubuntu version to another? .... and why ?? as i found it like that in ubuntu 18.04 # use the syslog group by default, since this is the owning group # of /var/log/syslog. su root…
User..
  • 63
  • 5