<br clear="all">---<br>Hey! Hey! You! You! Get off of my cloud!<br><a href="http://news.cnet.com/8301-13578_3-20002423-38.html">http://news.cnet.com/8301-13578_3-20002423-38.html</a><br>
<br><br><div class="gmail_quote">On Fri, Dec 3, 2010 at 14:25, Rich Mahn <span dir="ltr">&lt;<a href="mailto:rich@lat.com">rich@lat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">Donald Russell &lt;<a href="mailto:russell.don@gmail.com">russell.don@gmail.com</a>&gt; wrote:<br>
<br>
&gt;    I have an application that uses the logger -t &lt;tag&gt; command to add<br>
&gt;    specific messages in /var/log/messages. I&#39;d like to add those in a<br>
&gt;    section of it&#39;s own in the logwatch report but am having trouble<br>
&gt;    following the information in /usr/share/doc/logwatch-7.3 in the HOWTO<br>
&gt;    doc.<br>
&gt;    I added my new script/filter<br>
&gt;    /etc/logwatch/scripts/services/myfilter<br>
&gt;    myfilter is one simple awk comand:<br>
&gt;    awk &#39;{ if (&quot;mytag:&quot; == $5) { print; }}&#39;<br>
</div>&gt;    I added the config file for it...A  /etc/logwatch/conf/myfilter.conf<br>
<div class="im">&gt;    Title = &quot;My App Messages&quot;<br>
&gt;    LogFile = messages<br>
&gt;    I also tried a more explicit, LogFile = /var/log/messages<br>
&gt;    What else do I need to do? when I add a test message to the log with<br>
&gt;    logger -t mytag this is a test<br>
&gt;    then run logwatch, I&#39;m not seeing the test message in the report<br>
&gt;    What did I miss?<br>
&gt;    Thank you.<br>
&gt;<br>
<br>
</div>It&#39;s complicated--there are many many options and, since it&#39;s perl scripts,<br>
there&#39;s many ways to do it.<br>
<br>
The myfilter.conf file gives options for pre-processing your log file.<br>
Look at /usr/share/logwatch/default.conf/services/*.conf for examples.<br>
Look at arpwatch.conf for a simple example.  Note the &quot;OnlyService&quot; and<br>
the &quot;RemoveHeaders&quot; lines.  They are probably similar to what you want<br>
if you are pulling lines from /var/log/messsages.<br>
<br>
Then look at some files in /usr/share/log/watch/scripts/service.<br>
I like the &#39;afpd&#39; as an example of how to grab data from the lines<br>
you are looking at.<br>
<br>
In your /etc/logwatch/scripts/services directory, make sure the<br>
permissions are 644 -- they are not executable.<br>
<br>
This should be enough to get you started.  Report back with more specific<br>
problems for more specific help.<br>
<br>
Good luck<br>
<font color="#888888"><br>
<br>
Rich<br>
</font></blockquote></div><br><br>Thanks Rich,<br><br>I followed the examples, but when I tried &quot;logwatch --service myfilter&quot; I was geting an error:<br>    Logwatch does not know how to process service: myfilter<br>

<br>I solved THAT by correcting the name of myfilter in /etc/logwatch/conf/services from myfilter to myfilter.conf<br><br>Now it&#39;s working.... now I can concentrate on the actual report. :-)<br><br>Cheers!<br><br>So, for anybody else looking to add a report section in logwatch<br>

<br>your filter config file goes here: /etc/logwatch/conf/services and must be named &lt;service&gt;.conf<br>the actual filter goes here: /etc/logwatch/scripts/services and must be named &lt;service&gt;<br><br>Where &lt;service&gt; is whatever you want to call it... it just has to be the same in both places... makes sense.<br>

<br>Then logwatch --service &lt;service&gt; will produce your report.<br><br>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&#39;t bother figuring that out... it was simpler to do what I need in Perl than to figure out the nuances of Logwatch configuration. ;-)<br>

<br>Now that I&#39;ve actually done it once, it seems pretty simple... so why did it appear so complicated in the doc? hmmm.<br><br><br>