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 (https://icinga.com/) License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html> 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/icinga2.pid
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.