Sorry to double-dip on this one, but your example below brought up a new
problem. My work-around for the file_basename issue was this:
Exec $file.name = file_name(); \
if $file.name =~ s/^.*\\(.*)$// $file.name = $1;
But having seen your suggestion, I tried this:
Exec if file_name() =~ s/^.*\\(.*)$// $file.name = $1;
But when I did that, I got a syntax error 3 lines further down in the config
file. My _impression_ is that something in that syntax caused nxlog to
"consume" the data on that line, and the next three lines, right up to the end
of the module.
Any thoughts about what I might be missing there?
-----Original Message-----
From: Marvin Nipper
Sent: Tuesday, June 18, 2013 5:55 AM
To: 'Botond Botyanszki'; [email protected]
Subject: RE: [nxlog-ce-users] Should file_basename work on a Windows system?
THANKS for the planned fix! I've kept (but commented out) the function, and
had already (temporarily) coded a regex, which seems to be doing the trick. I
DO appreciate you offering up a solution!
Thanks again. Have a great week.
-----Original Message-----
From: Botond Botyanszki [mailto:[email protected]]
Sent: Tuesday, June 18, 2013 3:52 AM
To: [email protected]
Subject: Re: [nxlog-ce-users] Should file_basename work on a Windows system?
Hi,
The backslash is the culprit. Will be fixed in the next release. Thanks for
spotting this.
Meanwhile you should be able to extract the filename with a regexp:
if file_name() =~ /\([^\]+)$/ $basename = $1; (Untested, so not sure whether I
got the above right)
Regards,
Botond
On Mon, 17 Jun 2013 14:15:32 +0000
Marvin Nipper <[email protected]> wrote:
> I wanted to get the base file name for something on Windows Server 2008, so
> that I could pass that along in the log entry being generated. I was testing
> using an IIS server (just because it's easy to generate logs). I had
> initially been using file_name(), which was giving me this:
> c:\inetpub\logs\LogFiles\W3SVC\u_ex130617.log
>
> So then I added the xm_fileop Extension, and used this:
> file_basename(file_name())
>
> However, this generated exactly the same, fully-qualified file name that I'd
> previously been getting. I know that the example cited in the manual showed
> a Unix (forward slashes) file name being extracted, so I'm not sure if it is
> the backslashes that are causing the problem, or something else that I'm
> doing wrong?
>
> Any thoughts would be appreciated. Thanks!
>
> Marvin Nipper
>
>
> The information transmitted, including any content in this communication is
> confidential, is intended only for the use of the intended recipient and is
> the property of The Western Union Company or its affiliates and subsidiaries.
> If you are not the intended recipient, you are hereby notified that any use
> of the information contained in or transmitted with the communication or
> dissemination, distribution, or copying of this communication is strictly
> prohibited. If you have received this communication in error, please notify
> the Western Union sender immediately by replying to this message and delete
> the original message
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
nxlog-ce-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users
The information transmitted, including any content in this communication is
confidential, is intended only for the use of the intended recipient and is the
property of The Western Union Company or its affiliates and subsidiaries. If
you are not the intended recipient, you are hereby notified that any use of the
information contained in or transmitted with the communication or
dissemination, distribution, or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify the
Western Union sender immediately by replying to this message and delete the
original message
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
nxlog-ce-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users