<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Conditionally monitor log files in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39017#M7227</link>
    <description>&lt;P&gt;Hm, &lt;/P&gt;

&lt;P&gt;I believe that you can achieve most of your goals by NOT rsyncing the log files. Unless the log files are needed by the system as part of its operation, this would let you;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;have active forwarders continually monitoring the logs on both hot and standby system&lt;/LI&gt;
&lt;LI&gt;create log files according to your conditional script execution&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;And you'd only get one copy of the events in the index. As for redundancy if that is an issue, each event will be stored in Splunk and on either system (but not both).&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
    <pubDate>Mon, 20 Aug 2012 07:12:34 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2012-08-20T07:12:34Z</dc:date>
    <item>
      <title>Conditionally monitor log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39016#M7226</link>
      <description>&lt;P&gt;Background: Active and Standby server with key directories replicated periodically (every 5 mins) via rsync, including shell scripts and logs. The active server syncs changes to standby server. All scheduled scripts check for the existence of a 'live server flag file' e.g. /opt/LIVESERVER.txt, on the local filesystem and will not execute if the file does not exist. This way, crontab can be enabled on both systems but scripts will only execute on the live side, where the LIVERSERVER flag file exists.&lt;/P&gt;

&lt;P&gt;I have a Splunk Universal Forwarder installed on each node. Any scripted inputs can simply have the flag file logic added to them, however I am struggling to work out a way that I can conditionally monitor a log file, i.e. only monitor if some file exists on the local filesystem.&lt;/P&gt;

&lt;P&gt;At the moment, we manually stop the Splunk Forwarder on the standby side and only ever run the forwarder on the active node. Ideally, I want both forwarders running all the time, so that I can monitor other files/services on both sides, but I don't want to have the rsynced log files read at the live side, the re-read at the standby side. I only ever want the forwarder to monitor log files on the active node.&lt;/P&gt;

&lt;P&gt;I know that a "monitor_if_exists" option doesn't exist, but something like below would be exactly what I am after:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///apps/log/test.log]
index = test
sourcetype = TestLog
monitor_if_exists = /opt/LIVESERVER.txt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Anyone know of any way to achieve this?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:17:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39016#M7226</guid>
      <dc:creator>nvonkorff</dc:creator>
      <dc:date>2020-09-28T12:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally monitor log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39017#M7227</link>
      <description>&lt;P&gt;Hm, &lt;/P&gt;

&lt;P&gt;I believe that you can achieve most of your goals by NOT rsyncing the log files. Unless the log files are needed by the system as part of its operation, this would let you;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;have active forwarders continually monitoring the logs on both hot and standby system&lt;/LI&gt;
&lt;LI&gt;create log files according to your conditional script execution&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;And you'd only get one copy of the events in the index. As for redundancy if that is an issue, each event will be stored in Splunk and on either system (but not both).&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 07:12:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39017#M7227</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-08-20T07:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally monitor log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39018#M7228</link>
      <description>&lt;P&gt;So that you retain your duplicated logs, can't you just have another script in place that will check for the liveserver.txt file and only if it exists then rsync your files to another directory on the local server (e.g. "splunkMonFiles")... then it will still only update the files when changes are made (i.e. via rsync), but Splunk will effectively only be reading from the "liveserver" as there will be no changes to the "splunkMonFiles" directory on the standby-server.&lt;/P&gt;

&lt;P&gt;Then the only issue would be disk-usage, however if they are just standard text files (etc) then this should not take up too much space.&lt;/P&gt;

&lt;P&gt;Hope that makes sense.&lt;/P&gt;

&lt;P&gt;MHibbin&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 08:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39018#M7228</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-08-20T08:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally monitor log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39019#M7229</link>
      <description>&lt;P&gt;Yep, just exclude the specific log directories from the rsync. Makes total sense. Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 23:43:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39019#M7229</guid>
      <dc:creator>nvonkorff</dc:creator>
      <dc:date>2012-08-20T23:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally monitor log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39020#M7230</link>
      <description>&lt;P&gt;glad it helped.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 00:18:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Conditionally-monitor-log-files/m-p/39020#M7230</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-08-21T00:18:15Z</dc:date>
    </item>
  </channel>
</rss>

