Is it possible to change the Icinga log location from /var/log/ to /some/other/dir/?

Hello,
I am running Icinga Master services on a single node and i am running into issues with /var/log/ filling up due to constraints with the platform cloud image. However i do have a mounted storage directory called /storage/. Is it possible to change where Icinga writes logs? i want to do this without the nasty method of using sym links if possible.

My initial thoughts were to edit the systemd files to accomplish this. Any thoughts?

Hi,

/var/log is like a specification from Linux itself. But theoretically you could create a hardlink to another directory

Hello,
You’ll want to edit this file :
/etc/icinga2/features-enabled/mainlog.conf
And maybe this one as well
/etc/icinga2/features-available/debuglog.conf

If you suspect you have other filelogger wandering around, just go after them :
icinga2 object list --type FileLogger

It should contain something like this :

object FileLogger "main-log"  {
  severity = "information"
  path = "/var/log/icinga2/icinga2.log"
}

Change it to whatever you need, but make sure that the icinga log dir you’ll create have those permissions :

# getfacl "/var/log/icinga2/"
getfacl: Removing leading '/' from absolute path names
# file: var/log/icinga2/
# owner: icinga
# group: icingacmd
user::rwx
group::r-x
other::---

Related doc :
https://icinga.com/docs/icinga2/latest/doc/14-features/#logging
https://icinga.com/docs/icinga2/latest/doc/09-object-types/#filelogger

1 Like

@Someone interesting solution. It seems that I forgot this or I kept reading that the past times.

However, one should not forget that there are (can also) other files than the both in the example
And with this variant, don’t forget logrotate! So you have also to edit “/etc/logrotate.d/icinga2” and change the files to the no path!

Wow that answer was right under my nose. Thank you !

Thank you the FileLogger solution worked