question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deb: log rotation issue

See original GitHub issue

I just noted that my Debian installed salt-minion still has its deleted log file open:

# sudo lsof|grep delete
...
salt-mini 32090          root    3w      REG                8,1        5318     524377 /var/log/salt/minion.1 (deleted)

I wen’t to check the logrotation config file that comes with salt-common and notice that it does not signal to salt-minion that it has rotated it in any way.

Am I missing something here? If not, there are three possible solutions:

  • add copytruncate to master and minion log rotation. This has the downside of log lines actually might go missing. Not good for security and/or debugging.
  • add pre- and postrotation scripts that shutdown master/minion. Works, but requires downtime. Definitely not good for long running minion tasks.
  • Somehow signal to the minion and master that they should rotate their logs. This is the best option of them all. Also the trickiest since it requires patching Python code.

Oh - forgot to write - I have not modified the log rotation config files in any way on my local machine.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
anlutrocommented, Mar 23, 2016

What about adding a signal handler for SIGUSR1 which closes and re-opens the file handler? Then, in the logrotate configuration:

  postrotate
    pkill -SIGUSR1 -F /run/salt-master.pid
  endscript
0reactions
stale[bot]commented, Apr 12, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to debug logrotate warnings or errors when logrotate is ...
Run the logrotate command manually in a debug mode and check for errors: ... Identify a configuration file causing the issue.
Read more >
Troubleshooting issues with log rotation and archiving - AskF5
The logrotate script may not be configured to run daily. Processes may be logging at debug level. Logs may not be configured to...
Read more >
logrotate won't rotate my logs automatically - Server Fault
Check that your logrotate is being run by cron. Edit: From the comment discussion - it appears that cron is not working correctly....
Read more >
Sample logrotate configuration and troubleshooting -
The debug flag, -d , tells logrotate to go through the motions of rotating logs but not actually rotate them. It can be...
Read more >
Solved: Hive log rotation issue on CDH 6 - Cloudera Community
In this CDH version, hive log4j changes from rotation by size (configured by cloudera manager) to rotation by size and day (RFA to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found