Hi Paul,
$Hostname refers to a particular field in the log currently being
processed. NXLog wakes up to do stuff using <Schedule> and this is
independent from the log processing, thus fields are not available in
this context.
<Extension exec>
Module xm_exec
</Extension>
<Output out>
File '/mnt/raid0/nxlog/' + $Hostname + '.log'
<Schedule out_schedule>
When @hourly
Exec exec("/path/to/my/script.sh"); out->reopen();
</Schedule>
</Output>
script.sh would iterate on each relevant file under /mnt/raid0/nxlog/ and
could do whatever is needed.
Regards,
Botond
On Sun, 13 Jul 2014 19:32:31 -0700
Paul Fontenot <[email protected]> wrote:
> Any help on this would be greatly appreciated, I would like to do
> something like this
>
> <Output tcp_out>
> Module om_file
> Exec to_syslog_bsd();
> File '/mnt/raid0/nxlog/' + $Hostname + '.log'
> <Schedule out_schedule>
> When @hourly
> Exec file_rename("/mnt/raid0/nxlog/" + $Hostname +
> ".log", "/mnt/raid0/nxlog/" + $Hostname + '-' + strftime(now(),
> "%Y%m%d")); out_schedule->reopen();
> </Schedule>
> </Output>
>
> But I'm unsure how to get the value of $Hostname to work in the Schedule
> block. The log tells me the following which I take to mean that
> $Hostname is not available in the Schedule block.
>
> "expression evaluation has been aborted;missing logdata, no field
> available in this context"
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
nxlog-ce-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users