Changing location of log file

Article ID:204421824
1 minute readKnowledge base

Issue

  • Want to change the location of the jenkins log from its default location of /var/log/jenkins to a different location.

Environment

  • CloudBees Jenkins Enterprise

Resolution

Jenkins main log output is not configurable on RedHat native packages. You can change the init script, but I would not recommend to do so. You will then need to change logrotate configuration and it will introduce conflicts on package upgrade.

I would suggest to transform /var/log/jenkins to a symlink pointing to the new destination.

If SELinux is enabled you will likely need to fix the default context in the new location as the new location will not have the required attributes for logrotate (which means that logs don’t get rotated!).

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.