portertech / chef-monitor

An OpsCode Chef cookbook for monitoring services, wrapping the Sensu cookbook.
http://community.opscode.com/cookbooks/monitor
84 stars 102 forks source link

Fix for check-log.rb to handly invalid UTF-8 characters #31

Open gihuphil opened 9 years ago

gihuphil commented 9 years ago

Hi all,

I was having some trouble with check-log.rb here. It crashed while parsing /var/log/syslog, because it found some really weird characters in there, which were logged e. g. together with strange GET requests. I fixed this for me applying the patch below, its a one liner. Maybe you want to consider applying this to the check, making it more robust, though it may drop some bytes now.

Kind Regards,

Philipp

@@ -106,6 +106,7 @@ @log.seek(@bytes_to_skip, File::SEEK_SET) end @log.each_line do |line|