-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
naemon's logrotate leaves open file: livestatus.log.1 #146
Comments
SIGUSR1 is only implemented in naemon-core. Right now, there is no callback for NEB modules to register for log rotation events. Might be a good idea. |
since we no longer SIGHUP the core to rotate the logfile, we need to reopen the logfile in the module manually. references: - ConSol-Monitoring/omd#146
should be fixed with naemon/naemon-livestatus#107 |
since we no longer SIGHUP the core to rotate the logfile, we need to reopen the logfile in the module manually. references: - ConSol-Monitoring/omd#146
The issue reappeared in 5.2
@sni : any further hints how to diagnost? |
i'll have to investigate. At least i change the logrotate order to move the livestatus logfile before sending the rotate signal to naemon. |
@sni at least in 5.3.0 this is not working so far even after the order was changed: Retried sending SIGUSR1:
Looks like there is still a somehow stale process alive, having the rotated file open, which is meanwhile compressed. pstree:
|
since the command worker forks the main naemon process, it inherits all open files like ex.: pidfile, logfiles, etc... It will keep those references open, even if the main process rotates and reopens those files. This patch closes query handler and pid file references after starting the command worker and also moves starting the command worker before initializing the neb modules, so it won't inherit open logfiles from neb modules. references: - ConSol-Monitoring/omd#146 Signed-off-by: Sven Nierlein <[email protected]>
according to the lsof, there are two processing holding references to the logfile. One reopens the logfile on rotation and the other does not. Turns out this is the "command file worker" spawned once during initial start which inherits the file handles but doesn't do anything with it. |
the patch is included in tomorrows omd daily if you want to give it a try |
since the command worker forks the main naemon process, it inherits all open files like ex.: pidfile, logfiles, etc... It will keep those references open, even if the main process rotates and reopens those files. This patch closes query handler and pid file references after starting the command worker and also moves starting the command worker before initializing the neb modules, so it won't inherit open logfiles from neb modules. references: - ConSol-Monitoring/omd#146 Signed-off-by: Sven Nierlein <[email protected]>
Found:
Processes
PID 1634 is the child of the master process 1554
Current logrotate config
only send SIGUSR to master process:
Tried to send SIGUSR1 to the related child process, but this wasn't helpful, stale log file is still open
SIGUSR1 to the master process was also not helpful
Looks like some more magic is needed to avoid stale log files
The text was updated successfully, but these errors were encountered: