Graylog internal logs logging level change

Hi,

I want to change the logging for the internal logging to log error level logs only. I have changed the setting in log4j2.xml and restarted graylog. But i am not able to change the logging level.
I am running graylog on a cluster of 2 nodes.

  <?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="org.graylog2.log4j" shutdownHook="disable">
    <Appenders>
        <RollingFile name="rolling-file" fileName="/var/log/graylog-server/server.log" filePattern="/var/log/graylog-server/server.log.%i.gz">
            <PatternLayout pattern="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX} %-5p [%c{1}] %m%n"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="50MB"/>
            </Policies>
            <DefaultRolloverStrategy max="10" fileIndex="min"/>
        </RollingFile>

        <!-- Internal Graylog log appender. Please do not disable. This makes internal log messages available via REST calls. -->
        <Memory name="graylog-internal-logs" bufferSize="500"/>
    </Appenders>
    <Loggers>
        <!-- Application Loggers -->
        <Logger name="org.graylog2" level="error"/>
        <Logger name="com.github.joschi.jadconfig" level="error"/>
        <!-- This emits a harmless warning for ActiveDirectory every time which we can't work around :( -->
        <Logger name="org.apache.directory.api.ldap.model.message.BindRequestImpl" level="error"/>
        <!-- Prevent DEBUG message about Lucene Expressions not found. -->
        <Logger name="org.elasticsearch.script" level="error"/>
        <!-- Disable messages from the version check -->
        <Logger name="org.graylog2.periodical.VersionCheckThread" level="off"/>
        <!-- Suppress crazy byte array dump of Drools -->
        <Logger name="org.drools.compiler.kie.builder.impl.KieRepositoryImpl" level="error"/>
        <!-- Silence chatty natty -->
        <Logger name="com.joestelmach.natty.Parser" level="error"/>
        <!-- Silence Kafka log chatter -->
        <Logger name="kafka.log.Log" level="error"/>
        <Logger name="kafka.log.OffsetIndex" level="error"/>
        <!-- Silence useless session validation messages -->
        <Logger name="org.apache.shiro.session.mgt.AbstractValidatingSessionManager" level="error"/>
        <Root level="error">
            <AppenderRef ref="rolling-file"/>
            <AppenderRef ref="graylog-internal-logs"/>
        </Root>
    </Loggers>
</Configuration>

Can you please guide me how to change this?

Thanks

That’s currently not possible.

The log level of the root logger will always be INFO (unless you’re running Graylog in debug mode, in which case it will be DEBUG).

Code reference:

is it possible to disable logging completely? i can see there is if condition which is to log only errors. How can I enable this in the config file. I want graylog to log only errors.

 } else if (onlyLogErrors()) {
    logLevel = Level.ERROR;
} else {
    logLevel = Level.INFO;
}

You could remove all appenders from your log4j2.xml file, but I strongly advise against doing that.

That’s not possible, but you could use a Threshold filter for all of your appenders:
https://logging.apache.org/log4j/2.0/manual/filters.html#ThresholdFilter

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