NetXMS Support Forum

English Support => General Support => Topic started by: prutser on January 09, 2008, 12:03:51 PM

Title: Log.Scan()?
Post by: prutser on January 09, 2008, 12:03:51 PM
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.
Title: Re: Log.Scan()?
Post by: Alex Kirhenshtein on January 11, 2008, 05:30:55 PM
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.
Title: Re: Log.Scan()?
Post by: prutser on January 21, 2008, 12:55:32 PM
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!
Title: Re: Log.Scan()?
Post by: Anth0ny on June 18, 2008, 09:53:57 AM
is it support a Windows Event Logs?
=)

or this @ plan only...?
Title: Re: Log.Scan()?
Post by: Victor Kirhenshtein on June 18, 2008, 04:09:18 PM
Still only a plans unfortunately....