Default log directory change

Hi all,

I am trying to find out the way to change Icinga 2 log directory. Below is the version information.

root@monitor:~# icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.12.3-1)

Copyright (c) 2012-2021 Icinga GmbH (
License GPLv2+: GNU GPL version 2 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: Ubuntu
  Platform version: 20.04.1 LTS (Focal Fossa)
  Kernel: Linux
  Kernel version: 5.4.0-1034-gcp
  Architecture: x86_64

Build information:
  Compiler: GNU 9.3.0
  Build host: runner-hh8q3bz2-project-298-concurrent-0
  OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020

Application information:

General paths:
  Config directory: /etc/icinga2
  Data directory: /var/lib/icinga2
  Log directory: /var/log/icinga2
  Cache directory: /var/cache/icinga2
  Spool directory: /var/spool/icinga2
  Run directory: /run/icinga2

Old paths (deprecated):
  Installation root: /usr
  Sysconf directory: /etc
  Run directory (base): /run
  Local state directory: /var

Internal paths:
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/

The VM is hosted in Google Cloud and due to the limited boot disk size, I’d like to move the default log directory to another disk which is mounted to the system. The default log directory is /var/log/icinga2 as I can see above. I think I found the related configuration file which is /etc/icinga2/features-available/mainlog.conf and the below line looks quite interesting to me at the moment.

path = LogDir + "/icinga2.log"

Now, my question is, is it possible to set a new value for LogDir? If so, how can I do that? I’ve tried to put that into constants.conf file, restarted icinga2 but no luck. If anyone could assist, I’d appreciate it. Thank you.


I ended up with moving the icinga2 directory from /var/log to a mounted directory and creating a symbolic link.

I am not sure if this is okay to do but couldn’t find any other ways to modify LogDir variable.

If anyone could suggest a better idea, I’d appreciate it.



maybe this helps:

Hi @stevie-sy,

Thanks for that, it was helpful. The doco says it is read-only clearly. Need to read more :grinning:


nevertheless, why not just think it simple?
Just write instead the const “LogDir” your path :wink:


I am having a bit difficulty in understanding your English. Are you saying overwriting LogDir will work? I’ve tried define LogDir into constants.conf file and it didn’t work.


Instead of

path = LogDir + "/icinga2.log"


path = "/my/path/icinga2.log"

in /etc/icinga2/features-available/mainlog.conf

And of course the same for the debug.log.


I guess I can do that.

  • Does that affect anything at all? Because I believe Log directory will be still shown as /var/log/icinga2. Are mainlog and debug log the only ones using that directory?
  • What about log rotation? I guess I have to update that as well?

Thanks a lot.


Yes, there could be other files in /var/log/icinga2. If you want to move these files also, you have to do this in the way the docs describe it.
And yes, you have also think about logrorate.

And of course, the way you already did with symlinks is possible.