Log.Scan()?

Started by prutser, January 09, 2008, 12:03:51 PM

Previous topic - Next topic

prutser

Hello everyone,

First a happy new year and best wishes for everyone.

I would like to know how the function Log.Scan is used. I can see it on one of the screenshots, but don't find any documentation on it.
I basically want to read a text file, and check for the content of the file...

Thanxx in advance for the help...
Peter.

Alex Kirhenshtein

Hello.

Actually, log scanner in it current state is a more a hack than a production grade code - it was made for a specific task.
However, you can try to use it:

1) while logscan subagent is already included in windows version (i believe so), you should compile it manually on unix (or add "--enable-unstable" parameter to configure, this will enable some additional features, including logscan subagent):
$ cd netxms-VERSION
$ ./configure ...
$ cd src/agent/subagents/logscan
$ make install


2) add libnsm_logscan.so/logscan.nsm to you nxagentd.conf (SubAgent parameter)
3) now you can call LogScan.FindString parameter with two arguments: filename and substring to search. If substring is found - whole string returned, empty string otherwise.

LogScan works on per-line basis; it stops search when substring is found, so if you have multiple lines matching - FindString will return them all. Position in file is persisted between requests; log rotation is detected only by file size (e.g. if last known file position is beyond the end of file)

wbr, alex.

prutser

Ok, thank you very much for your help. After adding the Logscan.nsm to the client config file and restarting the client and core, I can indeed search a textfile... Very nice!

Anth0ny

is it support a Windows Event Logs?
=)

or this @ plan only...?

Victor Kirhenshtein

Still only a plans unfortunately....