Bug: "--hostformat split" and hostnames with dashes

Sean Alexandre <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <20131031180304.GA13043@tuzo>
==== Debian package: logwatch
==== Version: 7.4.0+svn20120502rev103-1

==== Problem: 

Hostnames with dashes in them cause "--hostformat split" to report on
log messages for the wrong host. For example, the report for moose gets both
of these messages instead of just the first.

Oct 30 12:29:14 moose sshd[24380]: Accepted publickey for frank from 95.111.111.11 port 22 ssh2
Oct 30 13:06:06 moose-web sshd[8049]: Accepted publickey for frank from 95.111.111.11 port 22 ssh2

==== Fix: 

The pattern that the onlyhost script uses to match against hostname uses \b:
if ($line =~ m/^... .. ..:..:.. $hostname\b/io) { 

Instead it should use \s:
if ($line =~ m/^... .. ..:..:.. $hostname\s/io) { 

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.