Support Questions
Find answers, ask questions, and share your expertise

ambari-agent logs clean

Contributor

I'm looking for a solution to clean logs of ambari-agent in HDP 3.1.4

I would like to keep logs during a retention period, and delete them after.

Can I configure this clean in the configuration file ambari-agent.ini, or do I need to use another system like logrotate ?

Thanks in advance

1 REPLY 1

Super Collaborator

@Stephbat 

To enable rotation  for the ambari-agent, follow below steps:

  1. cp /etc/ambari-agent/conf/logging.conf.sample /etc/ambari-agent/conf/logging.conf 
  2. Change the following line:
    args=('/var/log/ambari-agent/ambari-agent.log',"a", 10000000, 25)
    Where: The value 10000000 is the maximum size of the logs in bytes and the value 25 is the number of old logs to keep after the log rotates.
  3. Restart the ambari-agent after making the changes.