<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: shell script for checking if the system logs are updating in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120931#M92967</link>
    <description>If the system is in production, I would check all the log files daily (unless there are some that never update unless there is an error). The absolute simplest method is to look at ll, the last date that the file was modified. This requires virtually no CPU time, but you have to also put into the logs something that says that the application is working OK. Log files are often just for errors and therefore, no news is good news. But that does not verify that the applications are running correctly.</description>
    <pubDate>Thu, 27 Dec 2007 13:32:57 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2007-12-27T13:32:57Z</dc:date>
    <item>
      <title>shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120924#M92960</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;I need to write a shell script for checking if the system logs are updating.&lt;BR /&gt;&lt;BR /&gt;Sometimes it so happens that someone changes the configuration in syslog.conf due to which the logging stops.&lt;BR /&gt;&lt;BR /&gt;I want to run a monthly script which will check if the log files are updating..&lt;BR /&gt;&lt;BR /&gt;How can i achieve this.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Sunny</description>
      <pubDate>Wed, 26 Dec 2007 06:48:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120924#M92960</guid>
      <dc:creator>Sunny Jaisinghani</dc:creator>
      <dc:date>2007-12-26T06:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120925#M92961</link>
      <description>&lt;!--!*#--&gt;What would it take to determine if the logfiles are updating?  A modification date within the last day or week?  If so, you could use something like:&lt;BR /&gt;$ find /var/adm/syslog/syslog.log -mtime -7&lt;BR /&gt;If you don't get any output, then the file hasn't changed in 7 days.&lt;BR /&gt;&lt;BR /&gt;If you only care about since the last time your ran your script, you can touch a reference file and then compare that with the current logfile with this syntax:&lt;BR /&gt;if [ logfile -nt ref_file ]; then&lt;BR /&gt;   echo "logfile is newer"&lt;BR /&gt;else&lt;BR /&gt;   echo "logfile hasn't been updated"&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Dec 2007 10:07:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120925#M92961</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-26T10:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120926#M92962</link>
      <description>Hi Denis,&lt;BR /&gt;&lt;BR /&gt;Thanks for your response.&lt;BR /&gt;The find command just skipped out of my mind.&lt;BR /&gt;&lt;BR /&gt;This will solve my purpose.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 26 Dec 2007 10:17:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120926#M92962</guid>
      <dc:creator>Sunny Jaisinghani</dc:creator>
      <dc:date>2007-12-26T10:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120927#M92963</link>
      <description>hi sunny ;&lt;BR /&gt;&lt;BR /&gt;save file line count to another file and check every 15 ( for example ) minutes for line count .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for example &lt;BR /&gt;&lt;BR /&gt;linecnt=`cat /test/syslog.filecnt`&lt;BR /&gt;&lt;BR /&gt;file=/usr/adm/syslog/syslog.dated&lt;BR /&gt;&lt;BR /&gt;newcnt=`cat $file | wc -l`&lt;BR /&gt;&lt;BR /&gt;if [ $newcnt -gt $linecnt ] ; then &lt;BR /&gt;      let diff=$newcnt-$filecnt&lt;BR /&gt;      cat $file | tail -${diff} &amp;gt; difffile&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;echo $newcnt &amp;gt; /test/syslog.filecnt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;check for write mistakes.&lt;BR /&gt;&lt;BR /&gt;Hasan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Dec 2007 10:23:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120927#M92963</guid>
      <dc:creator>Hasan  Atasoy</dc:creator>
      <dc:date>2007-12-26T10:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120928#M92964</link>
      <description>not sure what version of hp-ux your using, but doesn't syslogd provide a file mark/timestamp every 20 minutes by default and can modified with the -m option.&lt;BR /&gt;&lt;BR /&gt;why don't you check that the file has been updated with it's timestamp mark</description>
      <pubDate>Wed, 26 Dec 2007 19:26:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120928#M92964</guid>
      <dc:creator>blah2blah</dc:creator>
      <dc:date>2007-12-26T19:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120929#M92965</link>
      <description>An even simpler method is to use the logger command. You use this command to generate all the different priorities and service requests, then simply look that all of them now appear in your syslog file. In fact, *NO* change should be allowed to syslog.conf unless followed immediately by the logger tests. Waiting for a month is far too long to way for a notice that a bad change by a root user was made.</description>
      <pubDate>Thu, 27 Dec 2007 04:51:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120929#M92965</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-12-27T04:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120930#M92966</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The fact mentioned by "blah2blah" about syslogd won't work for me. I have a bunch of log files which i have to check.&lt;BR /&gt;&lt;BR /&gt;Yes. Even i thought 1 month is too long to check if anything is wrong with syslog.conf&lt;BR /&gt;&lt;BR /&gt;May be i can run the script weekly.&lt;BR /&gt;&lt;BR /&gt;Anyways thanks for your valuable suggestions.&lt;BR /&gt;&lt;BR /&gt;REgards</description>
      <pubDate>Thu, 27 Dec 2007 06:10:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120930#M92966</guid>
      <dc:creator>Sunny Jaisinghani</dc:creator>
      <dc:date>2007-12-27T06:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120931#M92967</link>
      <description>If the system is in production, I would check all the log files daily (unless there are some that never update unless there is an error). The absolute simplest method is to look at ll, the last date that the file was modified. This requires virtually no CPU time, but you have to also put into the logs something that says that the application is working OK. Log files are often just for errors and therefore, no news is good news. But that does not verify that the applications are running correctly.</description>
      <pubDate>Thu, 27 Dec 2007 13:32:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120931#M92967</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-12-27T13:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120932#M92968</link>
      <description>Hello Bill,&lt;BR /&gt;&lt;BR /&gt;The purpose of the script is to check if all the log files (selected ones) are present and if they are getting updated.&lt;BR /&gt;This script is going to be deployed on all kind of servers, production, development, archieve, backup etc... &lt;BR /&gt;So there will some files which may not get updated for some period of time. &lt;BR /&gt;Hence planning for a weekly check.&lt;BR /&gt;&lt;BR /&gt;This is what the person who is going to audit the server has asked for.&lt;BR /&gt;&lt;BR /&gt;The contents which are logging to syslog and other log files depend upon the correct configuration of syslog.conf. And this is a different point to look at..&lt;BR /&gt;&lt;BR /&gt;However i have noted the points you mentioned. :)&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Thu, 27 Dec 2007 13:54:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120932#M92968</guid>
      <dc:creator>Sunny Jaisinghani</dc:creator>
      <dc:date>2007-12-27T13:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120933#M92969</link>
      <description>As long as you are only checking files created by syslog, then logger is the correct tool. The syslog.conf file has the ability sort various messages among different log files and the logger command (available on virtually any system that has the syslog facility) can be used weekly (or daily) to verify that syslogd is working correctly.&lt;BR /&gt; &lt;BR /&gt;For completeness, look at /var/adm for all the other logfiles that are kept on your system.</description>
      <pubDate>Thu, 27 Dec 2007 14:07:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120933#M92969</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-12-27T14:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: shell script for checking if the system logs are updating</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120934#M92970</link>
      <description>&lt;!--!*#--&gt;Hi Sunny:&lt;BR /&gt;&lt;BR /&gt;Here's another way to verify that a file is being updated.  This one-liner will return one (1) to denote failure and zero (0) to denote an updated file, exactly like any standard Unix command would be expected to do.  You can than construct any logic around that that you need.&lt;BR /&gt;&lt;BR /&gt;# perl -le 'exit 1 if -M "/var/adm/syslog/syslog.log" &amp;gt; 3600/86400'&lt;BR /&gt;&lt;BR /&gt;This tests then named file's modification timestamp.  In this example, the script exits with one (1) if the "syslog.log" has *not* been updated in more than *one_hour* (60 seconds times 60 minutes) of a day (60 seconds times 60 minutes times 24 hours).&lt;BR /&gt;&lt;BR /&gt;Nothing more is needed --- no temporary files nor complex logic.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Dec 2007 15:39:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-for-checking-if-the-system-logs-are-updating/m-p/4120934#M92970</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-12-27T15:39:42Z</dc:date>
    </item>
  </channel>
</rss>

