From df25b183cb256440a53d1c2fc582b98ceb25d444 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 24 Apr 2019 11:33:43 +0200 Subject: [PATCH] Add log message for log rotate; update docs refs #6737 --- doc/14-features.md | 19 ++++++++++++++++--- lib/base/application.cpp | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/14-features.md b/doc/14-features.md index 6411be836..3bdbd6743 100644 --- a/doc/14-features.md +++ b/doc/14-features.md @@ -21,9 +21,22 @@ By default file the `mainlog` feature is enabled. When running Icinga 2 on a terminal log messages with severity `information` or higher are written to the console. -Packages will install a configuration file for logrotate on supported -platforms. This configuration ensures that the `icinga2.log`, `error.log` and -`debug.log` files are rotated on a daily basis. +### Log Rotation + +Packages provide a configuration file for [logrotate](https://linux.die.net/man/8/logrotate) +on Linux/Unix. Typically this is installed into `/etc/logrotate.d/icinga2` +and modifications won't be overridden on upgrade. + +Instead of sending the reload HUP signal, logrotate +sends the USR1 signal to notify the Icinga daemon +that it has rotate the log file. Icinga reopens the log +files then: + +* `/var/log/icinga2/icinga2.log` (requires `mainlog` enabled) +* `/var/log/icinga2/debug.log` (requires `debuglog` enabled) +* `/var/log/icinga2/erorr.log` + +By default, log files will be rotated daily. ## DB IDO diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 57ca8688f..a939db446 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -706,6 +706,9 @@ void Application::SigIntTermHandler(int signum) */ void Application::SigUsr1Handler(int) { + Log(LogInformation, "Application") + << "Received USR1 signal, reopening application logs."; + RequestReopenLogs(); } -- 2.40.0