In the following:
Exec if file_name() =~ /[\w-]+\.log/ $FileName = $1;
You do not have any brackets to capture what you want $1 to be.
Not sure if they should be ( ) or \( \) for nxlog; check the manual or try
both. I think you should be able to say basename(file_name()), but I
haven't tried that myself.
Cheers,
Cameron
On Saturday, 30 August 2014, Jon Brouse <jbro...@zonoff.com> wrote:
> I am trying to get all logs under a single directory to write to separate
> files. I've read over some previous emails but still have issues. When I
> use the recommended syntax to parse out the name the files aren't being
> written to the server. Here is the configuration I'm using:
>
> <Input mfglog>
> Module im_file
> File "/path/to/logs/*.log"
> InputType LineBased
> SavePos TRUE
> Exec if file_name() =~ /[\w-]+\.log/ $FileName = $1;
> Exec $raw_event ="[" + hostname() + "]" + "[" + $FileName + "]"
> + $raw_event;
> </Input>
>
>
> When I attempt to use the file_name() the file name adds the path twice to
> the folder structure.
> Exec $raw_event ="[" + hostname() + "]" + "[" + file_name() +
> "]" + $raw_event;
>
> For example if the foo.log resides in /foo/bar/ the the folder structure
> on the log server is as follows:
> /foo/bar/foo.log/foo/bar/foo.log.log
>
> Also, could I use file_basename to achieve the desired results?
>
--
--
Cameron Kerr <cameron.kerr...@gmail.com>
See my blog at http://distracted-it.blogspot.co.nz/ (previously
http://humbledown.org/)
Skype me on cameron.kerr.nz
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
nxlog-ce-users mailing list
nxlog-ce-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users