How do I keep my Amazon Linux EC2 instance /var/log/messages from being filled with dhclient and ec2net messages?
Solution 1:
This just involves telling the logging system to ignore messages from dhclient
and ec2net
. Edit the /etc/rsyslog.conf
file, and after the #### RULES ####
line and before the lines defining logging for the other files, add these two lines:
:programname,isequal,"dhclient" ~
:programname,isequal,"ec2net" ~
The ~
indicates "don't log this" per the rsyslog.conf
man page.
Then, run service rsyslog restart
to have the system restart the logging daemon.
For Amazon Linux 2, rsyslogd has been updated to support the somewhat more intuitive "stop" keyword, so you can use these lines instead:
:programname,isequal,"dhclient" stop
:programname,isequal,"ec2net" stop
And restart the service with systemctl restart rsyslog
.