From: Randal L. Schwartz on
>>>>> "Ben" == Ben Morrow <ben(a)morrow.me.uk> writes:

Ben> In my stat(2) (FreeBSD 7.3-RELEASE) I have

Ben> | st_birthtime Time when the inode was created.

Ben> It's possible this is just a FreeBSD thing, but I thought it was a
Ben> 4.4-ism.

Definitely not in the One True Unix, therefore, not portable.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: John Bokma on
GRP <rengaprasath(a)gmail.com> writes:

> hi,
>
> I would like to write a script to grep some pattern in few set of log
> files and alert it...
>
> In order to avoid duplicate alert i plan to store the "FILENAME:ERR-
> LINE-NUMBER:FILE-CREATION-TIME" in a flat file (colon delimiter) , so
> that next time if the same pattern found in same line it will check
> against the flat file and won't alert. At the same time if it happens
> in different line number it wud check in flat file & the 2nd filed
> would be different so it will alert.

It might help if you describe when a clash can occur, i.e. why do you
need the inode creation time, and why is filename:err-line-no not unique
(I can think of reasons, but want to know the ones in your situation.)

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: GRP on
On Apr 27, 10:17 am, John Bokma <j...(a)castleamber.com> wrote:
> GRP <rengapras...(a)gmail.com> writes:
> > hi,
>
> > I would like to write a script to grep some pattern in few set of log
> > files and alert it...
>
> > In order to avoid duplicate alert i plan to store the "FILENAME:ERR-
> > LINE-NUMBER:FILE-CREATION-TIME"  in a flat file (colon delimiter) , so
> > that next time if the same pattern found in same line it will check
> > against the flat file and won't alert. At the same time if it happens
> > in different line number it wud check in flat file & the 2nd filed
> > would be different so it will alert.
>
> It might help if you describe when a clash can occur, i.e. why do you
> need the inode creation time, and why is filename:err-line-no not unique
> (I can think of reasons, but want to know the ones in your situation.)
>
> --
> John Bokma                                                               j3b
>
> Hacking & Hiking in Mexico -  http://johnbokma.com/http://castleamber.com/- Perl & Python Development

Hi John,

For example lets say i run my script at 10am where i found the error
pattern in the line number 100, i will store in a flat file in this
format "FILENAME:LINE-NUMBER" and the script will alert a msg to
tivoli. In the next run at 10.30am, assume there is no error found
other than line number 100, my script should not alert it since it's
already alerted. In order to achieve this along with "FILENAME:LINE-
NUMBER" i need to store some other value which is constant (ex. file
creation time , not change time), so that i can compare against it and
if found different i assume error happened in different line.

Since there is no way to capture file-creation-time i;m looking for
some other way to achieve this or probably you can suggest better
logic to achieve this...

thanks

From: John Bokma on
GRP <rengaprasath(a)gmail.com> writes:

> On Apr 27, 10:17 am, John Bokma <j...(a)castleamber.com> wrote:
>> GRP <rengapras...(a)gmail.com> writes:
>> > hi,
>>
>> > I would like to write a script to grep some pattern in few set of log
>> > files and alert it...
>>
>> > In order to avoid duplicate alert i plan to store the "FILENAME:ERR-
>> > LINE-NUMBER:FILE-CREATION-TIME"  in a flat file (colon delimiter) , so
>> > that next time if the same pattern found in same line it will check
>> > against the flat file and won't alert. At the same time if it happens
>> > in different line number it wud check in flat file & the 2nd filed
>> > would be different so it will alert.
>>
>> It might help if you describe when a clash can occur, i.e. why do you
>> need the inode creation time, and why is filename:err-line-no not unique
>> (I can think of reasons, but want to know the ones in your situation.)

> For example lets say i run my script at 10am where i found the error
> pattern in the line number 100, i will store in a flat file in this
> format "FILENAME:LINE-NUMBER" and the script will alert a msg to
> tivoli. In the next run at 10.30am, assume there is no error found
> other than line number 100, my script should not alert it since it's
> already alerted.

Clear, but FILENAME:LINE-NUMBER is already sufficient to stop that from
happening, unless you forgot to mention something.

> In order to achieve this along with "FILENAME:LINE-
> NUMBER" i need to store some other value which is constant (ex. file
> creation time , not change time), so that i can compare against it and
> if found different i assume error happened in different line.

Do the lines in the file have a time stamp?

> Since there is no way to capture file-creation-time i;m looking for
> some other way to achieve this or probably you can suggest better
> logic to achieve this...

I am still missing important information. Give an example of a
possible clash.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: GRP on
On 27 Apr, 11:40, John Bokma <j...(a)castleamber.com> wrote:
> GRP <rengapras...(a)gmail.com> writes:
> > On Apr 27, 10:17 am, John Bokma <j...(a)castleamber.com> wrote:
> >> GRP <rengapras...(a)gmail.com> writes:
> >> > hi,
>
> >> > I would like to write a script to grep some pattern in few set of log
> >> > files and alert it...
>
> >> > In order to avoid duplicate alert i plan to store the "FILENAME:ERR-
> >> > LINE-NUMBER:FILE-CREATION-TIME"  in a flat file (colon delimiter) , so
> >> > that next time if the same pattern found in same line it will check
> >> > against the flat file and won't alert. At the same time if it happens
> >> > in different line number it wud check in flat file & the 2nd filed
> >> > would be different so it will alert.
>
> >> It might help if you describe when a clash can occur, i.e. why do you
> >> need the inode creation time, and why is filename:err-line-no not unique
> >> (I can think of reasons, but want to know the ones in your situation.)
> > For example lets say i run my script at 10am where i found the error
> > pattern in the line number 100, i will store in a flat file in this
> > format "FILENAME:LINE-NUMBER" and the script will alert a msg to
> > tivoli. In the next run at 10.30am, assume there is no error found
> > other than line number 100, my script should not alert it since it's
> > already alerted.
>
> Clear, but FILENAME:LINE-NUMBER is already sufficient to stop that from
> happening, unless you forgot to mention something.
>
> > In order to achieve this along with "FILENAME:LINE-
> > NUMBER" i need to store some other value which is constant (ex. file
> > creation time , not change time), so that i can compare against it and
> > if found different i assume error happened in different line.
>
> Do the lines in the file have a time stamp?
>
> > Since there is no way to capture file-creation-time i;m looking for
> > some other way to achieve this or probably you can suggest better
> > logic to achieve this...
>
> I am still missing important information. Give an example of a
> possible clash.
>
> --
> John Bokma                                                               j3b
>
> Hacking & Hiking in Mexico -  http://johnbokma.com/http://castleamber.com/- Perl & Python Development

here it goes....

Script will check for pattern in few log files (lets say its looking
for pattern "Out-of-Memory" in /u1/app/log/WL.log & /u2/app/log/WL.log
etc.. ).

These WL.log files from different directories will delete & overwrite
once it reach 10mb. It may happen in a day or in few days.

Since i need a maintain a flat file or Database like below
<directory-and-file-name>:<err-line-number>:<some-other-constant-value-
example.filecreation-time>

the reason being maintaining a flat/database file because if the same
pattern "Out-of-Memory" found in the same line, it should check in the
flat file & if the entry found it wont alert. Whereas the same pattern
found in a different line , it will not be available in the flat file
and alert will trigger.

Since the log files may rotate often i need to tag someother value
along with filename and linenumber in the flat file which is key
value. I can't simply store <directory-and-file-name>:<err-line-
number> in flat file , becos once the file recreated and if the error
comes in the same line, it wont get alerted , which is wrong. In order
to overcome i taught of storing file creation time, which is not
possible.

Hope i clarified now.... :)

thks