Ask Your Question
0

Puppet agent not displaying log levels

asked 2017-12-14 14:00:34 -0500

puser gravatar image

I want to be able to go into my puppet-agent log file and grep out specific log levels that I am not interested in. For example if I have 1000 lines of puppet logs, maybe I just want to know see the errors so I could do

cat /var/log/messages | grep err

What I see in my environment today is:

On AIX

cat /var/log/messages | grep puppet-agent
Dec 14 14:30:02 hostname daemon:notice puppet-agent[16646184]: Applied catalog in 34.29 seconds

This is ideal as you can see the notice level of the log telling you the catalog run is complete and how long it took.

On Linux

cat /var/log/message | grep puppet-agent
Dec 14 14:54:46 hostname puppet-agent[99358]: Applied catalog in 3.37 seconds

This is less than ideal becuase it doesn't tell you what the log level is. The same goes for errors, debug, warnings... etc.

Why do the AIX systems show log level but not the Linux systems? Is there a way to turn this on?

thanks,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-12-18 09:26:12 -0500

stivesso gravatar image

updated 2017-12-18 09:27:48 -0500

Hi puser,

What you are looking for is recording the Priority of Syslog Messages (click on this link for more details).
To get the output you need, add the following lines in /etc/rsyslog.conf (after $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat , and comment that directive) and restart rsyslog service.

$template TraditionalFormatWithPRI,"%timegenerated% %HOSTNAME% %pri-text% %syslogtag%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate TraditionalFormatWithPRI

See below the logs output before/after this configuration,

Before,

Dec 18 13:08:38 myhostname puppet-agent[1868]: Applied catalog in 7.79 seconds
Dec 18 13:13:17 myhostname puppet-agent[2147]: Using configured environment 'production'
Dec 18 13:13:17 myhostname puppet-agent[2147]: Retrieving pluginfacts
Dec 18 13:13:17 myhostname puppet-agent[2147]: Retrieving plugin
Dec 18 13:13:25 myhostname puppet-agent[2147]: Loading facts
Dec 18 13:14:00 myhostname puppet-agent[2147]: Caching catalog for myhostname.mylabserver.com
Dec 18 13:14:02 myhostname puppet-agent[2147]: Applying configuration version '1513602832'
Dec 18 13:14:08 myhostname puppet-agent[2147]: Applied catalog in 6.92 seconds

After,

Dec 18 15:02:40 myhostname daemon.info puppet-agent[3927]: Using configured environment 'production'
Dec 18 15:02:40 myhostname daemon.info puppet-agent[3927]: Retrieving pluginfacts
Dec 18 15:02:40 myhostname daemon.info puppet-agent[3927]: Retrieving plugin
Dec 18 15:02:41 myhostname daemon.info puppet-agent[3927]: Loading facts
Dec 18 15:02:45 myhostname daemon.info puppet-agent[3927]: Caching catalog for myhostname.mylabserver.com
Dec 18 15:02:45 myhostname daemon.info puppet-agent[3927]: Applying configuration version '1513609363'
Dec 18 15:02:45 myhostname daemon.notice puppet-agent[3927]: Applied catalog in 0.55
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-12-14 14:00:34 -0500

Seen: 39 times

Last updated: Dec 18 '17