<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://research.iat.sfu.ca/research/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rd39666751</id>
	<title>Research - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://research.iat.sfu.ca/research/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rd39666751"/>
	<link rel="alternate" type="text/html" href="https://research.iat.sfu.ca/Special:Contributions/Rd39666751"/>
	<updated>2026-04-09T22:52:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://research.iat.sfu.ca/research/index.php?title=Customizing_Logwatch&amp;diff=2532</id>
		<title>Customizing Logwatch</title>
		<link rel="alternate" type="text/html" href="https://research.iat.sfu.ca/research/index.php?title=Customizing_Logwatch&amp;diff=2532"/>
		<updated>2006-03-08T11:53:57Z</updated>

		<summary type="html">&lt;p&gt;Rd39666751: test&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are two basic customizations which we often perform:&lt;br /&gt;
# increase the header-information with machine-specific info (hardware, admininstrator(s), usage, etc):&lt;br /&gt;
# adjust the order of the information - we care very much about disk-usage, and prefer it &#039;&#039;first&#039;&#039;&lt;br /&gt;
Start by ensuring logwatch is actually installed!  A mail-transport agent (MTA) like Postfix must be installed and working (to receive the daily logwatch summary).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Logwatch Headers ==&lt;br /&gt;
Use this template, to create &#039;&#039;&#039;/etc/log.d/custom_header&#039;&#039;&#039; (ASCII, plain-text file)&lt;br /&gt;
 Machine info:  Pentium4 2.4GHz, 1GB, GigE, 40GB+120GB, RivaTNT&lt;br /&gt;
  Running RedHat 9 Linux&lt;br /&gt;
  Located in Research Server Room A (Beta Space, Surrey Campus)&lt;br /&gt;
  Used by Davis Marques &amp;lt;dmarques@sfu.ca&amp;gt;&lt;br /&gt;
  Into service xxx.  Re-purposed Dec. 15, 2004&lt;br /&gt;
  Administered by Gordon Pritchard &amp;lt;gordonp+corsair@sfu.ca&amp;gt;&lt;br /&gt;
Another example:&lt;br /&gt;
 Machine info:  Pentium4 dual-core 3GHz, 2GB, GigE, 80GB, ATI-R300-mobility&lt;br /&gt;
  Running Gentoo Linux&lt;br /&gt;
  Located in office  525 / The Axis (Beta Space, Surrey Campus)&lt;br /&gt;
  Used by Gordon Pritchard &amp;lt;gordonp+zero@sfu.ca)&lt;br /&gt;
  Into service September 6, 2005.&lt;br /&gt;
  Administered by Gordon Pritchard &amp;lt;gordonp+zero@sfu.ca&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To include this custom header, we now have to modify the main logwatch Perl script &#039;&#039;&#039;logwatch.pl&#039;&#039;&#039; to add the bold / red line:&lt;br /&gt;
* on a RedHat 9 machine, this file is /etc/log.d/scripts/logwatch.pl:&lt;br /&gt;
    $printing = &#039;y&#039;;&lt;br /&gt;
    print OUTFILE &amp;quot;\n ################### LogWatch $Version ($VDate) #################### \n&amp;quot;;&lt;br /&gt;
    print OUTFILE &amp;quot;       Processing Initiated: &amp;quot; . localtime(time) . &amp;quot;\n&amp;quot;;&lt;br /&gt;
    print OUTFILE &amp;quot;       Date Range Processed: $Config{&#039;range&#039;}\n&amp;quot;;&lt;br /&gt;
    print OUTFILE &amp;quot;     Detail Level of Output: $Config{&#039;detail&#039;}\n&amp;quot;;&lt;br /&gt;
    print OUTFILE &amp;quot;          Logfiles for Host: $Config{&#039;hostname&#039;}\n&amp;quot;;&lt;br /&gt;
    &amp;lt;font color=red&amp;gt;&#039;&#039;&#039;print OUTFILE &amp;quot;\n&amp;quot; . `/bin/cat  $BaseDir/custom_header` .  &amp;quot;\n&amp;quot;;&#039;&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
    print OUTFILE &amp;quot;################################################################ \n\n&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
* on a Gentoo machine, this file is /usr/sbin/logwatch.pl:&lt;br /&gt;
       outline( $index_par, &amp;quot;\n ################### LogWatch $Version ($VDate) #################### \n&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
   outline( $index_par, &amp;quot;       Processing Initiated: &amp;quot; . localtime(time) . &amp;quot;\n&amp;quot;);&lt;br /&gt;
   outline( $index_par, &amp;quot;       Date Range Processed: $Config{&#039;range&#039;}\n&amp;quot;);&lt;br /&gt;
   outline( $index_par, &amp;quot;                             $print_range\n&amp;quot;) if ($Config{&#039;range&#039;} ne &#039;all&#039;);&lt;br /&gt;
   outline( $index_par, &amp;quot;                             Period is &amp;quot; . GetPeriod() . &amp;quot;.\n&amp;quot;)&lt;br /&gt;
      if ($Config{&#039;range&#039;} ne &#039;all&#039;);&lt;br /&gt;
   outline( $index_par, &amp;quot;     Detail Level of Output: $Config{&#039;detail&#039;}\n&amp;quot;);&lt;br /&gt;
   outline( $index_par, &amp;quot;             Type of Output: $Config{&#039;output&#039;}\n&amp;quot;);&lt;br /&gt;
   outline( $index_par, &amp;quot;          Logfiles for Host: $Config{&#039;hostname&#039;}\n&amp;quot;);&lt;br /&gt;
   &amp;lt;font color=red&amp;gt;&#039;&#039;&#039;outline( $index_par, &amp;quot;\n&amp;quot; . `/bin/cat  $BaseDir/custom_header` .  &amp;quot;\n&amp;quot;);&#039;&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
   if ( $outtype_html or $outtype_htmlembed ) {&lt;br /&gt;
   outline( $index_par, &amp;quot;\n&amp;quot;);&lt;br /&gt;
   } else {&lt;br /&gt;
   outline( $index_par, &amp;quot;################################################################## \n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
== Logwatch Information Order ==&lt;br /&gt;
The scripts locate in &#039;&#039;&#039;/etc/log.d/scripts/services/&#039;&#039;&#039; are run according to their file-name ordering.  Simply renaming a file changes it&#039;s relationship to other information.  We should move &#039;&#039;&#039;zz-disk_space&#039;&#039;&#039; to &#039;&#039;&#039;aa-disk_space&#039;&#039;&#039; to have our disk-usage appear right after the custom header; as root:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;font color=red&amp;gt;zero&amp;lt;/font&amp;gt; &amp;lt;font color=blue&amp;gt;services # &amp;lt;/font&amp;gt;&#039;&#039;&#039;mv /etc/log.d/scripts/services/zz-disk_space /etc/log.d/scripts/services/aa-disk_space&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But wait - there&#039;s more!!&lt;br /&gt;
This disk-space script evolves through the various releases, often suppressing output if nothing prior is printed.  And, (now) as the first entry, nothing prior will &#039;&#039;&#039;ever&#039;&#039;&#039; get printed :-O  So, we&#039;ll strip out all the conditionals, and produce a pared-down script &#039;&#039;&#039;/etc/log.d/scripts/services/aa-disk_space&#039;&#039;&#039; which forever more will always give us our disk-usage as the first thing:&lt;br /&gt;
&lt;br /&gt;
Gentoo:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ##########################################################################&lt;br /&gt;
 # $Id: aa-disk_space,v 1.8 2005/02/24 17:08:05 kirk Exp $&lt;br /&gt;
 ##########################################################################&lt;br /&gt;
  &lt;br /&gt;
     echo&lt;br /&gt;
     df -hP | head -n1; df -hP | grep &#039;^[/ ]&#039;&lt;br /&gt;
RedHat 9:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ##########################################################################&lt;br /&gt;
 # $Id: disk_space,v 1.1 2003/01/13 04:00:59 kirk Exp $&lt;br /&gt;
 ##########################################################################&lt;br /&gt;
  &lt;br /&gt;
    echo&lt;br /&gt;
    echo&lt;br /&gt;
    echo &amp;quot;------------------ Disk Space --------------------&amp;quot;&lt;br /&gt;
    echo&lt;br /&gt;
    df -h&lt;br /&gt;
    echo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One more thing to do - there is a corresponding configuration file which we simply move (rename) to align with the above:&lt;br /&gt;
* on both Gentoo, and RedHat 9, this file is /etc/log.d/conf/services/zz-disk_space.conf&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;font color=red&amp;gt;zero&amp;lt;/font&amp;gt; &amp;lt;font color=blue&amp;gt;# &amp;lt;/font&amp;gt;&#039;&#039;&#039;mv /etc/log.d/conf/services/zz-disk_space.conf /etc/log.d/conf/services/aa-disk_space.conf&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To test it all, invoke the daily logwatch cron-job manually (Gentoo shown; others similar):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;font color=red&amp;gt;zero&amp;lt;/font&amp;gt; &amp;lt;font color=blue&amp;gt;# &amp;lt;/font&amp;gt;&#039;&#039;&#039;sh /etc/cron.daily/00-logwatch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow: auto; height: 1px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[_pw9_]&lt;br /&gt;
&lt;br /&gt;
[http://nvnv2006.com/ nvnv]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rd39666751</name></author>
	</entry>
</feed>