In message <[EMAIL PROTECTED]>,
Tim Peiffer writes:
>Hayward, Ben wrote:
>>  Many thanks Tim I am beginning to understand the internal_events a
>> little better.
>>
>> How can I tell SEC to monitor a new log at midnight if some of the logs
>> monitored are in the form of logname_YYYMMMDDD.log?
>>   
>I would think the best way to handle that would be to have a file blob 
>on input.
>
>sec.pl -input=logname_*.log
>
>And if we presume that you are using a startup script to do process 
>manipulation, use calendar to reload ~ midnight.
>type=Calendar
>desc=Reload myself to follow logs of logname_YYYMMMDDD.log format
>time=0 0 * * *
>action=spawn startup reload

The file blob works if you only have one or two files in the directory
(i.e. you don't retain the prior files) otherwise a month from now you
find sec opening 30 file descriptors and a year from now 365 file
descriptors 8-).

>Alternatively, you could have unix process manipulate symlinks at around
>midnight (rm logname.log ; ln -s logname_YYYMMMDDD.log logname.log ), 
>and then let SEC follow the inode changes automatically.  I suppose you 
>could embed that too as part of a calendar action.

I use hard links rather than symbolic links, however the idea is the
same.  The logs are contained in the parent directory and sec runs in
a subdirectory (properly chowned so sec can create the hard link).

#****v* calendar/relink_current
# SYNOPSIS
# relink_current - created hard link to newest log file in directory
# DESCRIPTION
# Every minute find the most recently written log file and obtain it's
# inode number.  Obtain the inode number of the file current (which
# must exist). If they have the same inode number, exit status 0. If
# they don't force current to be linked to the most recently written
# log file.
#******
type = calendar
time = * * * * * 
desc = relink current file
action = shellcmd (/bin/sh -c 'lastfile=`ls -tr .. | grep '\.log$'  | tail -n 
1`; [ `stat --printf "%i" current` -eq `stat --printf "%i" ../$lastfile` ] || 
ln -f ../$lastfile current')

--
                                -- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to