log-rotation

What's the easiest way to rotate nginx log files monthly?

夙愿已清 提交于 2021-02-08 09:20:07
问题 In OpenBSD, there's no logrotate in ports, and newsyslog seems to have limited features as far as monthly rotation of a huge number of log files is concerned. I have a lot of domains, a huge number of nginx log-files names like /var/www/logs/*/*.{access,error}.log . I'm thinking a small shell script and cronjob. What would be the easiest way to rotate them all monthly, and append the prior month to the filename? 回答1: I think the following crontab should work: 0 0 1 * * /etc/nginx/logrotate

Log rotation on logs consuming disk space in Google Cloud Kubernetes pod

别说谁变了你拦得住时间么 提交于 2020-06-25 18:08:57
问题 We have a pod in a Google Cloud Platform Kubernetes cluster writing JsonFormatted to StdOut. This is picked up by Stackdriver out of box. However, we see the disk usage of the pod just growing and growing, and we can't understand how to set a max size on the Deployment for log rotation. Documentation on Google Cloud and Kubernetes is unclear on this. This is just the last hour: 回答1: Are you sure that disk usage of the pod is high because of the logs? If the application writes logs to stdout,

Log rotation on logs consuming disk space in Google Cloud Kubernetes pod

拥有回忆 提交于 2020-06-25 18:08:41
问题 We have a pod in a Google Cloud Platform Kubernetes cluster writing JsonFormatted to StdOut. This is picked up by Stackdriver out of box. However, we see the disk usage of the pod just growing and growing, and we can't understand how to set a max size on the Deployment for log rotation. Documentation on Google Cloud and Kubernetes is unclear on this. This is just the last hour: 回答1: Are you sure that disk usage of the pod is high because of the logs? If the application writes logs to stdout,

Fluentd logging on kubernetes skips logs on log rotation

限于喜欢 提交于 2020-01-25 09:13:25
问题 Currently, I have the following architecuture in kubernetes: In a pod, a service and a sidecar container (called logger ) is running. The services writes to a file, the sidecar container reads that file and writes it to stdout. A fluentd daemonset is configured to read the output (which is collected in a file in /var/log/containers/*_logger-*.log , which is a link to another file (the latest file since the last file rotation, to the older files, no link points). Always 3 log messages belong

Logging Handlers Empty - Why Logging TimeRoatingFileHandler doesn't work

痞子三分冷 提交于 2019-12-23 12:45:18
问题 So I do logging.config.fileConfig to setup my logging from a file config that has console and file handler. Then I do logging.getLogger(name) to get my logger and log. At certain times I want the filehandler's filename to change i.e. log rotate (I can't use time rotator because of some issues with Windows platform) so to do that I call logger.handlers - it shows an empty list, so I cant close them!! However when I step through the debugger, its clearly not empty (well of course without it I

How to create one uwsgi log file per day?

吃可爱长大的小学妹 提交于 2019-12-09 15:42:04
问题 I use uwsgi with the parameter --daemonize /logs/uwsgi.log This file is however becoming large and I would like to split it into smaller pieces. One per day would be preferable. I have done that for nginx where it was easy to specify the log file name using date variables. Is it possible to do the same for uwsgi? Something like: [uwsgi] daemonize=/logs/uwsgi-$year-$month-$day.log Or is there another way to get the same result, without too much involvement of other processes? 回答1: uWSGI by

logrotate cron job not rotating certain logs

廉价感情. 提交于 2019-12-04 09:11:23
问题 I added two scripts in "logrotate.d" directory for my application logs to be rotated. This is the config for one of them: <myLogFilePath> { compress copytruncate delaycompress dateext missingok notifempty daily rotate 30 } There is a "logrotate" script in "cron.daily" directory (which seems to be running daily as per cron logs): #!/bin/sh echo "logrotate_test" >>/tmp/logrotate_test #/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1 /usr/sbin/logrotate -v /etc/logrotate.conf &>>/root

How to create one uwsgi log file per day?

感情迁移 提交于 2019-12-04 02:49:11
I use uwsgi with the parameter --daemonize /logs/uwsgi.log This file is however becoming large and I would like to split it into smaller pieces. One per day would be preferable. I have done that for nginx where it was easy to specify the log file name using date variables. Is it possible to do the same for uwsgi? Something like: [uwsgi] daemonize=/logs/uwsgi-$year-$month-$day.log Or is there another way to get the same result, without too much involvement of other processes? uWSGI by itself can only "split by size", with the --log-maxsize option. Time-based approaches are using classic

logrotate cron job not rotating certain logs

做~自己de王妃 提交于 2019-12-03 02:10:00
I added two scripts in "logrotate.d" directory for my application logs to be rotated. This is the config for one of them: <myLogFilePath> { compress copytruncate delaycompress dateext missingok notifempty daily rotate 30 } There is a "logrotate" script in "cron.daily" directory (which seems to be running daily as per cron logs): #!/bin/sh echo "logrotate_test" >>/tmp/logrotate_test #/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1 /usr/sbin/logrotate -v /etc/logrotate.conf &>>/root/logrotate_error EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t logrotate "ALERT exited

Logback, set max history files per day

半腔热情 提交于 2019-11-29 10:02:33
I use TimeBasedRollingPolicy and SizeAndTimeBasedFNATP triggering policy for my logback configuration. The rollover of log files is set to happen every day and it will also be triggered if log file size goes beyond a limit. If I do setMaxHistory(10) on TimeBasedRollingPolicy with a daily roll over, then it will archive all log files in last 10 days. But what I want is to set maxHIstory on SizeAndTimeBasedFNATP each day. Is this possible with logback? With SizeAndTimeBasedFNATP and MaxHistory set to 10, the logs older than 10 days will be removed (assuming daily rollover schedule). Size is not