Community Articles
Find and share helpful community-sourced technical articles
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)
Super Mentor

Many times we see some repeated logging inside our log files. For example in case of ambari-server.log we see the following kind of repeated logging inside the log.

WARNING: A HTTP GET method, public,,,java.lang.String,java.lang.String), should not consume any entity.

We might see the above kind of warning messages repeated many times.

# grep 'public' /var/log/ambari-server/ambari-server.log


- These are actually harmless WARNING messages, but many times it is desired to make sure that they are not logged, That way we can save some disk space issues and have a clean log.

- Every time it is not possible to change the rootLogger to "ERROR" like following to avoid printing some INFO/WARNING messages, Because it will cause suppressing other useful INFO/WARNING messages not t be logged.


- In order to avoid logging of few specific log entries based on the Strings irrespective of the various different logging level (INFO/WARNING/ERROR/DEBUG) those entries are coming from.

- In this case suppose, if we do not want to log the line which has "public" entry in it at any place then we can make use of StringMatchFilter feature of log4j as following:


Step-1). Edit the "/etc/ambari-serevr/conf/" and add the following 3 lines in it Just below to the "file" log appender.


Now the audit log appender will look like following:

# Direct log messages to a log file
log4j.appender.file.layout.ConversionPattern=%d{DATE} %5p [%t] %c{1}:%L - %m%n

NOTE: we can use as many filters we want. We will only need to change the filter number like "log4j.appender.file.filter.01", "log4j.appender.file.filter.02", "log4j.appender.file.filter.03" with different "StringToMatch" values.

Step-2). Move the OLD ambari-server logs and restart the ambari-server

# mv /var/log/ambari-server /var/log/ambari-server_OLD
# ambari-server restart


Step-3). Put the ambari-server.log in tail and then restart ambari server to see if the following line entry is gone from the ambari-server.log now and you should not see those lines again.

# grep 'public' /var/log/ambari-server/ambari-server.log


0 Kudos
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎08-29-2017 09:29 AM
Updated by:
Top Kudoed Authors