diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp index 4b294c70f..3a24bc770 100644 --- a/components/compat/compatcomponent.cpp +++ b/components/compat/compatcomponent.cpp @@ -55,6 +55,20 @@ String CompatComponent::GetObjectsPath(void) const return objectsPath; } +/** + * Retrieves the log path. + * + * @returns log path + */ +String CompatComponent::GetLogPath(void) const +{ + Value logPath = GetConfig()->Get("log_path"); + if (logPath.IsEmpty()) + return Application::GetLocalStateDir() + "/log/icinga2/compat"; + else + return logPath; +} + /** * Retrieves the icinga.cmd path. * diff --git a/components/compat/compatcomponent.h b/components/compat/compatcomponent.h index 3ca730c1d..94458e40c 100644 --- a/components/compat/compatcomponent.h +++ b/components/compat/compatcomponent.h @@ -44,6 +44,7 @@ private: String GetStatusPath(void) const; String GetObjectsPath(void) const; + String GetLogPath(void) const; String GetCommandPath(void) const; void DumpDowntimes(ofstream& fp, const DynamicObject::Ptr& owner);