Graylog-server.log - how to rotate?

(Morel666) #1

How to configure graylog-server log rotation? This log is configured in graylogctl script as LOG_FILE=${LOG_FILE:=log/graylog-server.log} variable. By default all new entries are appended to this file, so it grows infinitely. I would like to configure i to be rotated on daily basis or if it not possible, then on its size basis. How to achieve that?

(Jochen) #2

It’s currently not possible to customize the Log4j 2 configuration file in the Graylog omnibus package (which is being used by the OVA).

This being said, if you’re using a different type of installation (DEB, RPM, manual installation), you can customize the log4j2.xml file according to your requirements:

See for the specific file location of the Log4j 2 configuration file.

(Morel666) #3

My instance is set up as “manual installation”, but still by default graylogctl file contains this variable set up. How to move this configuration to log4j2.xml configuration file?
While graylogctl uses LOG_FILE variable in following way:

"${NOHUP}" "${JAVA_CMD}" ${JAVA_OPTS} ${LOG4J} -jar "${GRAYLOG_SERVER_JAR}" server -f "${GRAYLOG_CONF}" -p "${GRAYLOG_PID}" >> "${LOG_FILE}" 2>> "${LOG_FILE}" &

it means that default console output and error output of graylog is forwarded to this file. How to move this console outputs to log4j handlers?

(Jochen) #4

You can configure Log4j 2 to output everything into a file and not output anything on standard error/out (which is what would end up in ${LOG_FILE}).

You can also modify the graylogctl script according to your needs.

(system) #5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.