Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

logrotate

Logrotate – nginx logs not rotating inside docker container

December 27, 2023 by Tarik

As stated on the edit on my question the problem was that CMD from nginx:1.11 was only starting the nginx process. A work around is to place the following command on my Dockerfile CMD service cron start && nginx -g ‘daemon off;’ This will start nginx as nginx:1.11 starts it and well as start the … Read more

Categories docker Tags docker, docker-compose, dockerfile, logrotate, nginx Leave a comment

How to perform log rotation with Gunicorn?

December 13, 2023 by Tarik

If you do not want to bother with logrotare you can use a full python/gunicorn solution using python logging facilities. Create a file named log.conf with the content below. This will rotate the error log file and access log file daily and will keep the logs for 90 days. Log level is set to INFO. … Read more

Categories logging Tags gunicorn, logging, logrotate Leave a comment

How to insert a date inside the filename with logrotate

September 15, 2023 by Tarik

You should be able to keep the extension apart, e.g. whatever.2012-03-03.csv, with the following configuration: whatever.csv { dateext dateformat .%Y-%m-%d extension .csv … } Note the dateext is deliberately empty.

Categories linux Tags linux, logrotate Leave a comment

Logrotate to clean up date stamped files

August 28, 2023 by Tarik

Logrotate removes files according to order in lexically sorted list of rotated log file names, and also by file age (using last modification time of the file) rotate is maximal number of rotated files, you may find. If there is higher number of rotated log files, their names are lexically sorted and the lexically smallest … Read more

Categories linux Tags linux, logrotate, oracle Leave a comment

Logrotate files with date in the file name

August 14, 2023 by Tarik

(First post ever so if it looks like a drunk spider has formatted it then sorry) After using our friend Google, here and I can’t remember where else I managed to achieve something using logrotate (rather than cron or some other equivalent). I have a the following in /var/log/rsync/: -rw-r–r– 1 root root 1.1M Apr … Read more

Categories tomcat Tags date, logrotate, redhat, tomcat Leave a comment

Centos/Linux setting logrotate to maximum file size for all logs

June 28, 2023 by Tarik

As mentioned by Zeeshan, the logrotate options size, minsize, maxsize are triggers for rotation. To better explain it. You can run logrotate as often as you like, but unless a threshold is reached such as the filesize being reached or the appropriate time passed, the logs will not be rotated. The size options do not … Read more

Categories linux Tags centos, linux, logrotate Leave a comment

Apache and logrotate configuration

May 24, 2023 by Tarik

just add su root adm to the config file: /var/log/apache2/*.log { # … su root adm }

Categories apache Tags apache, apache2, logrotate, ubuntu Leave a comment

Hourly rotation of files using logrotate? [closed]

February 18, 2023 by Tarik

The manpage of logrotate.conf contains an important advice for the hourly option: Log files are rotated every hour. Note that usually logrotate is configured to be run by cron daily. You have to change this configuration and run logrotate hourly to be able to really rotate logs hourly. As pointed out by yellow1pl the solution … Read more

Categories linux Tags cron, linux, logrotate, rhel Leave a comment

Is it possible to run one logrotate check manually?

September 10, 2022 by Tarik

Yes: logrotate –force $CONFIG_FILE

Categories logging Tags logging, logrotate Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa