[fedora-list] How to add a new section in logwatch report

Rich Mahn rich at lat.com
Fri Dec 3 22:25:19 UTC 2010


Donald Russell <russell.don at gmail.com> wrote:

>    I have an application that uses the logger -t <tag> command to add
>    specific messages in /var/log/messages. I'd like to add those in a
>    section of it's own in the logwatch report but am having trouble
>    following the information in /usr/share/doc/logwatch-7.3 in the HOWTO
>    doc.
>    I added my new script/filter
>    /etc/logwatch/scripts/services/myfilter
>    myfilter is one simple awk comand:
>    awk '{ if ("mytag:" == $5) { print; }}'
>    I added the config file for it...A  /etc/logwatch/conf/myfilter.conf
>    Title = "My App Messages"
>    LogFile = messages
>    I also tried a more explicit, LogFile = /var/log/messages
>    What else do I need to do? when I add a test message to the log with
>    logger -t mytag this is a test
>    then run logwatch, I'm not seeing the test message in the report
>    What did I miss?
>    Thank you.
> 

It's complicated--there are many many options and, since it's perl scripts,
there's many ways to do it.

The myfilter.conf file gives options for pre-processing your log file.
Look at /usr/share/logwatch/default.conf/services/*.conf for examples.
Look at arpwatch.conf for a simple example.  Note the "OnlyService" and
the "RemoveHeaders" lines.  They are probably similar to what you want
if you are pulling lines from /var/log/messsages.

Then look at some files in /usr/share/log/watch/scripts/service.
I like the 'afpd' as an example of how to grab data from the lines
you are looking at.

In your /etc/logwatch/scripts/services directory, make sure the
permissions are 644 -- they are not executable.

This should be enough to get you started.  Report back with more specific
problems for more specific help.

Good luck


Rich


More information about the users mailing list