nook24 / statusengine

New PHP based MySQL Backend for Naemon and Nagios 4 + responsive web frontend
https://statusengine.org/
GNU General Public License v2.0
16 stars 8 forks source link

Logging of statusengine #15

Closed dhoffend closed 8 years ago

dhoffend commented 8 years ago

I've realized different things with the logging of statusengine cakephp application

1) The LegacyShell Daemon uses a hardcoded file handler to write the output to

2) The current hardcoded file handler logging doesn't log any timestamps in the logfile which makes it harder to analyse future possible problems or crashes.

3) The current code doesn't support logfile rotation. StatusengineLegacyShell.php could reopen (close/open) the logfile on SIGHUP or similar to support log rotation.

4) CakePHP provides a generic LogHandlerInterface which supports file, syslog and other handler. Is there a reason for not using the generic logging interface instead of fopen/fwrite? With generic logging and syslog you would tackle the logrotation problem also since logrotation can be taken care on the syslog server, etc

nook24 commented 8 years ago

I would prefer to use SysLog so that Statusengine don't need to take care about log rotation and stuff like this. And i like to replace LogfileTask with CakeLog class

nook24 commented 8 years ago

Now the error output is back on stderr: bildschirmfoto 2016-01-14 um 20 37 52 And all errors get logged to syslog: bildschirmfoto 2016-01-14 um 20 38 00

Same for notices: bildschirmfoto 2016-01-14 um 20 36 49

I changed syslog tag from Statusengine to statusengine so it's easy to grep for it. (After i took the screenshots...)

In the next step i will remove the LogfileTask. See: 51db9b6ab627e66c64bf4f1eb46e9699bdc83bde

dhoffend commented 8 years ago

Sounds great

nook24 commented 8 years ago

Hi @dhoffend, syslog support is done. Please checkout 38b360c94f544a62aa031ec4edeb51780447ea53 to see if it fits your needs...

nook24 commented 8 years ago

Merged into new Version 1.6.0