On Wed, 15 Feb 2006 13:08:04 +0100 henrik at hswn.dk (Henrik Stoerner) wrote:
Will this new logfile retrival also be able to look for logfiles with variable file names, ie. logfile.txt-20060215 for today and then a new filename logfile.txt-20060216 tomorrow ? I know its stupid but that's how the vendor creates it.
That's one variant I haven't seen yet. It would be tricky to implement; couldn't you just run something like this on the client daily via cron:
cd /var/log/myapp CURRENTLOG=
ls -t logfile.txt-* | head -1ln -s $CURRENTLOG logfile.txtand then Hobbit can look at logfile.txt ?
Hi Henrik,
At first, a very big HURRRRRAYY to Henrik and its quick growing up
**hobbit**. And thanks for your time and dedication.
A suggestion for this tricky situation (and maybe it could help
in two or tree other situation) would be support something like *date expansion* on the logfile variable. This could be done in two posible ways.
1) logfile = "/var/log/some_log.txt-%Y%m%d"
2) logfile - "/var/log/some_log.txt-$(+%Y%m%d --date '1 day')"
The first version could be build in, and use the standart time,
strftime ... functions.
The seccond could be used by these people who have gnu date on
its client systems, and hobbit client could expand the pattern using the date utility. I know, spawn/run external programs is not always so easy/secure, but may be an option.
A variation of the seccond option (much less secure, and much
more risk) could be support some kind of shell expansion, and sou accept one line shell scripts to get the correct name of the logfile. For example in the above case.
logfile = "/var/log/$SHELL(ls -t /var/log/app/my_app_log.txt.* |head -1)"
Anyway, these are only some thinkings... may be they can be
helpfull for something in the future.
Regards
Werner