<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Find text string within log file]]></title><description><![CDATA[<p dir="auto">Hi there,</p>
<p dir="auto">Can you please advise how I can configure netxms to monitor a folder on a node, this folder contains log files and if the log files contains a specific text string "Failed to connect to FX Server" an alert is generated?</p>
<p dir="auto">I have looked at Logwatch but I have no idea how to make this work, or if its even the correct parser to use.</p>
<p dir="auto">Can someone help me?</p>
<p dir="auto">Many thanks, Damien</p>
]]></description><link>https://forum.netxms.org/topic/4790/find-text-string-within-log-file</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 13:10:41 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4790.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Nov 2016 10:16:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find text string within log file on Fri, 12 Apr 2019 14:44:19 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Victor, putting the wildcards straight in the filename as you suggested worked perfectly;</p>
<p dir="auto">&lt;file&gt;C:\inetpub\wwwroot\website\logs\Log_%Y_%m_%d.txt&lt;/file&gt;</p>
]]></description><link>https://forum.netxms.org/post/25581</link><guid isPermaLink="true">https://forum.netxms.org/post/25581</guid><dc:creator><![CDATA[tickett]]></dc:creator><pubDate>Fri, 12 Apr 2019 14:44:19 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Fri, 12 Apr 2019 09:07:22 GMT]]></title><description><![CDATA[<p dir="auto">Yes, this is normal. On startup agent logs unexpanded file name. You should also see something like this when file is found:</p>
<p dir="auto">2019.04.12 12:03:13.608 *D* [logwatch           ] File "/tmp/test-20190412.log" (pattern "/tmp/test-`date +%Y%m%d`.log") successfully opened</p>
<p dir="auto">Are you sure your commands return correct values? You may also try to use cmd /c "command" within backticks (because echo for example is not an external executable but cmd's internal command).</p>
<p dir="auto">Also, if you only need current date/time you may use date/time macros without external commands, like this:</p>
<p dir="auto">&lt;file&gt;C:\inetpub\wwwroot\website\logs\Log_%Y_%m_%d.txt&lt;/file&gt;</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/25574</link><guid isPermaLink="true">https://forum.netxms.org/post/25574</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 12 Apr 2019 09:07:22 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Fri, 12 Apr 2019 06:27:26 GMT]]></title><description><![CDATA[<ul>
<li>I am trying this (dynamic filename) and struggling- I have tried;
<ul>
<li>using a wildcard * (didn't expect it to work, but worth a longshot)</li>
</ul>
</li>
<li>adding a macro (see below)</li>
<li>using backticks with an echo command directly</li>
<li>using backticks with a batch file which executes an echo command</li>
</ul>
<pre><code>&lt;macro name="timestamp"&gt;%Y_%m_%d&lt;/macro&gt;
</code></pre>
<p dir="auto">The log file seems to show whatever I enter and doesn't appear to show a "resolved" value. Is this normal? Regardless new log entries don't appear to be picked up.</p>
<pre><code>2019.04.11 09:31:02.328 *D* [logwatch           ] Parser thread for file "C:\inetpub\wwwroot\website\logs\Log_@{timestamp}.txt" stopped
2019.04.11 16:33:00.121 *D* [logwatch           ] Parser thread for file "C:\inetpub\wwwroot\website\logs\Log_`echo %date:~6,4%_%date:~3,2%_%date:~0,2%`.txt" started
2019.04.11 16:38:34.340 *D* [logwatch           ] Parser thread for file "C:\inetpub\wwwroot\website\logs\Log_*.txt" stopped
2019.04.11 16:38:34.906 *D* [logwatch           ] Parser thread for file "C:\inetpub\wwwroot\website\logs\Log_`c:\netxms\etc\date.bat`.txt" started
</code></pre>
<p dir="auto">I have the parser working fine for the Windows Event Log.</p>
<p dir="auto">Any ideas? TIA</p>
]]></description><link>https://forum.netxms.org/post/25570</link><guid isPermaLink="true">https://forum.netxms.org/post/25570</guid><dc:creator><![CDATA[tickett]]></dc:creator><pubDate>Fri, 12 Apr 2019 06:27:26 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Wed, 27 Feb 2019 20:01:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">You can use macros for forming date/time based file name (possible macros can be found here: <a href="http://www.cplusplus.com/reference/ctime/strftime/" rel="nofollow ugc">http://www.cplusplus.com/reference/ctime/strftime/</a>) or you can use output of shell script as file name using backticks, like this:</p>
<pre><code>&lt;file&gt;C:\FX_CHUB\LOGS\`C:\gen_file_name.cmd`&lt;/file&gt;
</code></pre>
<p dir="auto">In this example file name will be taken from output of script C:\gen_file_name.cmd</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/25396</link><guid isPermaLink="true">https://forum.netxms.org/post/25396</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 27 Feb 2019 20:01:27 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Wed, 27 Feb 2019 14:14:59 GMT]]></title><description><![CDATA[<p dir="auto">Hi, just to let you know, I have this working if I point the parser directly at a file:</p>
<p dir="auto">&lt;parser&gt;<br />
   &lt;file&gt;C:\FX_CHUB\LOGS\test.txt&lt;/file&gt;<br />
   &lt;rules&gt;<br />
      &lt;rule&gt;<br />
         &lt;match&gt;TCP Command Socket Failed Error&lt;/match&gt;<br />
         &lt;event&gt;LOGWATCH_PLXCENTRALHUB_176.74.191.177&lt;/event&gt;<br />
      &lt;/rule&gt;<br />
   &lt;/rules&gt;<br />
&lt;/parser&gt;</p>
<p dir="auto">I have created the event in the main Netxms console and an email is sent when the match string is inserted into the txt file, so that's great. </p>
<p dir="auto">The problem I now have is the logs within this folder are all variable names, is it possible to point the parser at a folder opposed to a direct file?  This way any log file in this file will be parsed looking for the string to match.</p>
<p dir="auto">I have tried &lt;file&gt;C:\FX_CHUB\LOGS\*&lt;/file&gt;  and &lt;file&gt;C:\FX_CHUB\LOGS\&lt;/file&gt;</p>
<p dir="auto">But this does not seem to work.  Many thanks for your help</p>
]]></description><link>https://forum.netxms.org/post/25392</link><guid isPermaLink="true">https://forum.netxms.org/post/25392</guid><dc:creator><![CDATA[dmna007]]></dc:creator><pubDate>Wed, 27 Feb 2019 14:14:59 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Tue, 08 Nov 2016 13:29:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi Damien</p>
<p dir="auto">Change in your nxagentd.conf '*LOGWATCH' to '[LOGWATCH]'.<br />
With your parser xml the string 'TEXT ERROR LOG' in your Logfile 'C:\test\logs' would generate an NetXMS event 100000. So this event 100000 must exist in your event configuration in NetXMS. You don't need a DCI for that.</p>
<p dir="auto">best regards<br />
Dani</p>
]]></description><link>https://forum.netxms.org/post/21347</link><guid isPermaLink="true">https://forum.netxms.org/post/21347</guid><dc:creator><![CDATA[user54119]]></dc:creator><pubDate>Tue, 08 Nov 2016 13:29:26 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Tue, 08 Nov 2016 11:36:35 GMT]]></title><description><![CDATA[<p dir="auto">sorry I made an error in my copy and paste, the remote agent config is defined as:</p>
<p dir="auto">#<br />
# NetXMS agent configuration file<br />
# Created by server installer at Tue Oct 11 15:24:54 2016<br />
#</p>
<p dir="auto">LogFile = {syslog}<br />
MasterServers = 127.0.0.1, 192.168.11.207<br />
FileStore = C:\NetXMS\var<br />
RequireAuthentication = yes<br />
SharedSecret = HIDDEN<br />
SubAgent = winperf.nsm<br />
SubAgent = portcheck.nsm<br />
SubAgent = logwatch.nsm<br />
# Below is log parsers definitions<br />
*LOGWATCH<br />
Parser = C:\NetXMS\parser1.xml</p>
]]></description><link>https://forum.netxms.org/post/21346</link><guid isPermaLink="true">https://forum.netxms.org/post/21346</guid><dc:creator><![CDATA[user59290]]></dc:creator><pubDate>Tue, 08 Nov 2016 11:36:35 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Tue, 08 Nov 2016 11:10:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi there,</p>
<p dir="auto">On the remote agent I have adjusted the conf file as described and in C:\NetXMS I have created a parser1.xml file</p>
<p dir="auto"><strong>remote agent conf</strong><br />
&lt;parser&gt;<br />
&lt;file&gt;C:\test\logs&lt;/file&gt;<br />
&lt;rules&gt;<br />
&lt;rule&gt;<br />
&lt;match&gt;TEST ERROR LOG&lt;/match&gt;<br />
&lt;event&gt;100000&lt;/event&gt;<br />
&lt;/rule&gt;<br />
&lt;/rules&gt;<br />
&lt;/parser&gt;</p>
<p dir="auto"><strong>parser1.xml</strong><br />
&lt;parser&gt;<br />
&lt;file&gt;C:\test\logs&lt;/file&gt;<br />
&lt;rules&gt;<br />
&lt;rule&gt;<br />
&lt;match&gt;TEST ERROR LOG&lt;/match&gt;<br />
&lt;event&gt;100000&lt;/event&gt;<br />
&lt;/rule&gt;<br />
&lt;/rules&gt;<br />
&lt;/parser&gt;</p>
<p dir="auto">When you say I need to create an event , do you mean a DCI for the remote node?  Thanks</p>
]]></description><link>https://forum.netxms.org/post/21344</link><guid isPermaLink="true">https://forum.netxms.org/post/21344</guid><dc:creator><![CDATA[user59290]]></dc:creator><pubDate>Tue, 08 Nov 2016 11:10:27 GMT</pubDate></item><item><title><![CDATA[Reply to Find text string within log file on Tue, 08 Nov 2016 10:47:15 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">yes, logwatch is a correct choice. Parser could be following:</p>
<pre><code>&lt;parser&gt;
   &lt;file&gt;/path/to/log/file&lt;/file&gt;
   &lt;rules&gt;
      &lt;rule&gt;
         &lt;match&gt;Failed to connect to FX Server&lt;/match&gt;
         &lt;event&gt;FX_SERVER_CONNECT_FAILED&lt;/event&gt;
      &lt;/rule&gt;
   &lt;/rules&gt;
&lt;/parser&gt;
</code></pre>
<p dir="auto">and add the following to nxagentd.conf:</p>
<pre><code># this is main section
SubAgent = logwatch.nsm

[LOGWATCH]
Parser = /path/to/parser.xml
</code></pre>
<p dir="auto">you have to create event FX_SERVER_CONNECT_FAILED on server (of course you can name it differently) - it will be generated each time this string will be found in log file.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/21341</link><guid isPermaLink="true">https://forum.netxms.org/post/21341</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 08 Nov 2016 10:47:15 GMT</pubDate></item></channel></rss>