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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




---
Hey! Hey! You! You! Get off of my cloud!
http://news.cnet.com/8301-13578_3-20002423-38.html


On Fri, Dec 3, 2010 at 14:25, Rich Mahn <rich@xxxxxxx> wrote:
Donald Russell <russell.don@xxxxxxxxx> 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


Thanks Rich,

I followed the examples, but when I tried "logwatch --service myfilter" I was geting an error:
ÂÂÂ Logwatch does not know how to process service: myfilter

I solved THAT by correcting the name of myfilter in /etc/logwatch/conf/services from myfilter to myfilter.conf

Now it's working.... now I can concentrate on the actual report. :-)

Cheers!

So, for anybody else looking to add a report section in logwatch

your filter config file goes here: /etc/logwatch/conf/services and must be named <service>.conf
the actual filter goes here: /etc/logwatch/scripts/services and must be named <service>

Where <service> is whatever you want to call it... it just has to be the same in both places... makes sense.

Then logwatch --service <service> will produce your report.

The filter itself is assumed to be written in Perl, so use Perl syntax in your filter script. Apparently you can configure a different languagein the .conf file, but I didn't bother figuring that out... it was simpler to do what I need in Perl than to figure out the nuances of Logwatch configuration. ;-)

Now that I've actually done it once, it seems pretty simple... so why did it appear so complicated in the doc? hmmm.


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux