#306913 logcheck: please allow @ in "hostname" part of logs

Package:
logcheck-database
Source:
logcheck
Submitter:
Peter Palfrader
Date:
2023-03-14 14:15:18 UTC
Severity:
wishlist
Tags:
Blocked By:
Bug Title
174331

  12

logcheck: propose support for macros in configs

wishlist stable testing unstable over 3 years ago

#306913#5
Date:
2005-04-29 10:52:38 UTC
From:
To:
When using with syslog-ng configured to also log the source of the log
entry log lines look like:

| Apr 24 06:47:01 s_local@nikki CRON[13878]: (pam_unix) session opened for user root by (uid=0)

Now logcheck doesn't usually allo for the @ in logs which results in
bascially no ignore line matching.  Please add @ to the regexes, thanks.

| System Events
| =-=-=-=-=-=-=
| Apr 24 06:47:01 s_local@nikki CRON[13878]: (pam_unix) session opened for user root by (uid=0)
| Apr 24 06:47:01 s_local@nikki su[13895]: + ??? root:nobody
| Apr 24 06:47:01 s_local@nikki su[13895]: (pam_unix) session opened for user nobody by (uid=0)
| Apr 24 06:47:06 s_local@nikki CRON[13878]: (pam_unix) session closed for user root
[..]


Peter

#306913#10
Date:
2005-05-03 22:12:40 UTC
From:
To:
~/src/logcheck/rulefiles/linux$ egrep '\[._\[:alnum:\]-\]'  -r . | wc -l
896

that's not fun. while changing all those we'd better switch to the use of
macros. very inclined to merge that with those open bugs.
regards
--
maks

#306913#15
Date:
2005-05-04 16:38:34 UTC
From:
To:
<snip log snippets>

Speaking of sed magic..

for i in *; do cat $i | sed -e "s/\[\._\[:alnum:\]-\]+/\[\._@\[:alnum:
\]-\]\+/" >> $i.new; done

..appears to work here..

#306913#20
Date:
2005-05-04 17:44:51 UTC
From:
To:
yes i know, could have done something similar with perl,
but we just want to change all hostname and who says they
are exactly formated like aboves and really hostnames you
change. needs human edit and than it's better to do it
right, no?

regards

#306913#25
Date:
2005-05-04 20:56:18 UTC
From:
To:
That only matches the first occurrence of [._[:alnum:]-]+ and since
every rule starts with "^\w{3} [ :0-9]{11} [._[:alnum:]-]+" it'll only
change the regexp we use for the hostname.

It's better than manually going through and changing every occurrence
800+ times. I've tested it here:

$ for i in *; do cat $i | sed -e "s/\[\._\[:alnum:\]-\]+/\[\._@\[:alnum:
\]-\]\+/" >> $i.new; done

$ egrep -vf ../logcheck/rulefiles/linux/TEST_ignore.d.server/postfix.new
postfix.log | egrep
-vf ../logcheck/rulefiles/linux/violations.ignore.d/logcheck-postfix
$

They work just as well as the old rules, they just match the additional
'@'..

However, if you'd rather wait for macro support, that's fine.

#306913#32
Date:
2005-10-15 22:55:47 UTC
From:
To: