Search the FirstSpirit Knowledge Base
Dear e-Spirit community,
when for Tomcat and Apache instances within the FirstSpirit editing environmnt the famous log rotation framework "logrorate" has already been setup and configured, there might be a reasonable interest to introduce "logrotate" for the FirstSpirit server, too.
At first, the "log4j" logrotation has to be disabled - whether a standard or custom log4j appender is used. To our understanding, this could be done via:
It's clear that "log4j" cannot be replaced completely, as the application references it within their Java classes. The above change will take effect on the following log files in "<fs_install_path>/log":
- "fs-server.log"
- "fs-clients.log"
- "fs-database.log"
- additional individually configured log file outputs configured in "fs-logging.properties"
except for the log files created in the "<fs_install_path>/log"-sub-folder named "schedule". Reason: these log files are not rotated as they are created per scheduler entry individually using individual files.
When in future log rotation for the above log files has to be guaranteed via "logrotate", a configuration file for "logrotate" is essential. See an example configuration file for FirstSpirit enclosed:
# continue and throw no error message when log file is not present
missingok
# truncate the original log file in place after creating a copy
copytruncate
# compress the file
compress
/opt/wcms/fs4/log/fs-server.log /opt/wcms/fs4/log/fs-clients.log /opt/wcms/fs4/log/fs-database.log {
# rotate hourly
hourly
# keep 96 hours (= 4 days) of backlogs, see hourly
rotate 96
# "dateext" directive has to be deactivated as search within FirstSpirit server
# monitoring would not work for FirstSpirit log files otherwise, see
# "FirstSpirit Manual for Administrators"
#dateext
# size that triggers log-rotation, here: 1024
size 1024M
}
/opt/wcms/fs4/log/fs-wrapper.log /opt/wcms/fs4/log/fs-gc.log {
# rotate daily
daily
# keep 4 days of backlogs, see daily
rotate 4
# "dateext" directive has to be deactivated as search within FirstSpirit server
# monitoring would not work for FirstSpirit log files otherwise, see
# "FirstSpirit Manual for Administrators"
dateext
}
Important: to ensure allowing searching FirstSpirit log files in FirstSpirit Web-Monitor, "log4j.appender.fs.datedLogging" has to be enabled for FirstSpirit's custom log4j-FSAppender (see "FirstSpirit Manual for Administrators", chapter "Logging configuration"). That's why logrotate's "dateext" directive has to be disabled for FirstSpirit specific log files.
Nevertheless, it might be much better to allow a complete deactivation of "logrotation" within the custom log4j FirstSpirit "FSAppender". Up to now, this is not possible
Our questions:
To allow to configure a timestamp based target log file name in "logrotate" natively a feature request has been raised @RedHat below: