Hi, As Marvin suggested, you should be able to use file_name(). There is a file_basename() function provided by xm_fileop, though the regexp does the same.
Regarding the second question, see http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html#troubleshooting_log_message_content , mainly the last example. There are other alternatives instead of using to_json(), such as to_kvp(), to_xml() and to_csv() to dump the fields. Beware that log_info() truncates long lines and strips linefeed, so instead of using this as in the last example a better alternative can be file_write() or using om_file. For some reason Marvin's mail didn't make it to my mailbox yet. Regards, Botond On Wed, 18 Sep 2013 14:12:57 +0100 Nick Brown <[email protected]> wrote: > Thanks Marvin. And file_name() is of course right there in the manual, > so I really ought to have spotted it; I suppose I wasn't expecting it > to be a function, and didn't think to search for file "underscore" > name. Ah well. > > And on the second point, I think rigging up some kind of output via > xm_kvp is probably going to do the trick. (The more I use nxlog, the > more I find myself wanting some kind of probe I can just stick in and > see what messages are flying around....) > > Cheers, > Nick > > On 18 September 2013 13:41, Marvin Nipper > <[email protected]> wrote: > > I can answer your first question (I think). I think that you want to use > > the file_name() function, as that should retrieve the fully-qualified > > path/file information. And if you need to only see the unqualified file > > name itself, I use something like this: > > if file_name() =~ /^.*\\(.*)$/ $file.name = $1; > > > > There may be a better way to strip off the path, but that's what I've used. > > > > I think that the answer to your last question is much more complex, as it > > really depends on the nature of your data, and how it may be parameterized > > and/or delimited. Certainly, at the most basic level, you could take any > > give line, and use a long RegEx (with parens to identify each unique > > parameter), and "parse" a set of uniform information into as many variables > > as you might wish (i.e. $1, $2, etc.), but there are numerous other > > built-in modules that are intended to handle a variety of standard formats, > > in a more native and intelligent fashion (e.g. xm_csv and xm_kvp), so (put > > simply) the answer to your question might vary greatly, depending on the > > nature/structure of the log information. Anyway, those are some ideas, and > > things that you could look into, as possible solutions. > > > > -----Original Message----- > > From: Nick Brown [mailto:[email protected]] > > Sent: Wednesday, September 18, 2013 6:24 AM > > To: [email protected] > > Subject: [nxlog-ce-users] Filenames in im_file > > > > Hi. > > > > (Can't find anything about this in the manual.) If I'm using a wildcard > > with im_file to capture from multiple files, is there a field that can tell > > me which filename a given message has come from? > > > > Perhaps this is really a more general question: what's a good technique for > > inspecting messages so that I can see all of the fields they contain? > > > > Thanks, > > Nick > > > > ------------------------------------------------------------------------------ > > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, > > SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power > > Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends > > 9/20/13. > > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > > _______________________________________________ > > 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 > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > nxlog-ce-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ nxlog-ce-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users
