<?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: Keep specific events and discard the rest in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375914#M110430</link>
    <description>&lt;P&gt;Thank you for your quick response, I will test your stanza and let you know.&lt;/P&gt;</description>
    <pubDate>Mon, 07 May 2018 15:35:11 GMT</pubDate>
    <dc:creator>Log_wrangler</dc:creator>
    <dc:date>2018-05-07T15:35:11Z</dc:date>
    <item>
      <title>Keep specific events and discard the rest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375912#M110428</link>
      <description>&lt;P&gt;How to filter sets of monitored logs with HF?&lt;/P&gt;

&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I have a number of logs files monitored by UFs and sent to autoLB HFs (which send downstream to the indexers).&lt;BR /&gt;&lt;BR /&gt;
I want to apply a regex filter to all the sources where I only collect logs that contain "error" or "warn".&lt;BR /&gt;
Example search:&lt;/P&gt;

&lt;P&gt;Index=common_index  sourcetype=my_app_logs   source = /temp/my_app/*&lt;/P&gt;

&lt;P&gt;This will return a number of "source" field values where source = &lt;/P&gt;

&lt;P&gt;/temp/my_app/logs/my_app.log&lt;BR /&gt;
/temp/my_app/logs/my_app_gc.log&lt;BR /&gt;
/temp/my_app/logs/my_app_user.log&lt;BR /&gt;
/temp/my_app/logs/my_app_bootstart.log&lt;/P&gt;

&lt;P&gt;On the UFs  I have:&lt;/P&gt;

&lt;P&gt;inputs.conf&lt;/P&gt;

&lt;P&gt;[monitor:///temp/my_app/logs/*]&lt;BR /&gt;
disabled = 0&lt;BR /&gt;
index = common_index&lt;BR /&gt;
sourcetype = my_app_logs&lt;/P&gt;

&lt;P&gt;outputs.conf&lt;/P&gt;

&lt;P&gt;[tcpout]&lt;BR /&gt;
defaultGroup = default-autolb-group&lt;BR /&gt;
indexAndForward = 0&lt;/P&gt;

&lt;P&gt;[tcpout-server://x.x.x.1:9997]&lt;/P&gt;

&lt;P&gt;[tcpout:default-autolb-group]&lt;BR /&gt;
disabled = false&lt;BR /&gt;
server = x.x.x.1:9997,y.y.y.2:9997&lt;/P&gt;

&lt;P&gt;[tcpout-server://y.y.y.2:9997]&lt;/P&gt;

&lt;P&gt;On the HFs  x.x.x.1, and y.y.y.2 I have:&lt;/P&gt;

&lt;P&gt;outputs.conf&lt;BR /&gt;
[tcpout]&lt;BR /&gt;
defaultGroup = default-autolb-group&lt;BR /&gt;
forwardedindex.filter.disable = true&lt;BR /&gt;
indexAndForward = 0&lt;BR /&gt;
maxQueueSize = 7MB&lt;/P&gt;

&lt;P&gt;[tcpout-server://i.i.i.1:9997]&lt;/P&gt;

&lt;P&gt;[tcpout-server://i.i.i.2:9997]&lt;/P&gt;

&lt;P&gt;[tcpout:default-autolb-group]&lt;BR /&gt;
disabled = false&lt;BR /&gt;
server = i.i.i.1:9997,i.i.i.2:9997&lt;/P&gt;

&lt;P&gt;Referencing [&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Forwarding/Routeandfilterdatad#Keep_specific_events_and_discard_the_rest" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Forwarding/Routeandfilterdatad#Keep_specific_events_and_discard_the_rest&lt;/A&gt;]&lt;/P&gt;

&lt;P&gt;It says to create "queue" stanzas in props and transforms (I am inferring on the HFs) this is where I need guidance.&lt;/P&gt;

&lt;P&gt;For example,  would I just add the following stanzas to the HFs?&lt;/P&gt;

&lt;P&gt;in props.conf&lt;/P&gt;

&lt;P&gt;[source::/temp/my_app/logs/*]   &amp;lt;------- this is for applying the REGEX filter to all monitored logs&lt;BR /&gt;
TRANSFORMS-set=setnull_myApp, setparsing_myApp&lt;/P&gt;

&lt;P&gt;in transforms.conf&lt;/P&gt;

&lt;P&gt;[setnull_myApp]&lt;BR /&gt;
REGEX = .&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = nullQueue&lt;/P&gt;

&lt;P&gt;[setparsing_myApp]&lt;BR /&gt;
REGEX = error, warn &amp;lt;------ ERROR OR WARN??&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/P&gt;

&lt;P&gt;My other question, if I want to selectively apply filters to some files (not all) source files would I create individual source stanzas?&lt;BR /&gt;
For example:&lt;/P&gt;

&lt;P&gt;[source::/temp/my_app/logs/my_app.log]&lt;/P&gt;

&lt;P&gt;and would I need to change props and transforms individually as well?&lt;BR /&gt;
For example:&lt;/P&gt;

&lt;P&gt;[setnull_myApp.log]&lt;/P&gt;

&lt;P&gt;[setparsing_myApp.log]&lt;/P&gt;

&lt;P&gt;Thank you for your guidance!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:22:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375912#M110428</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2020-09-29T19:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Keep specific events and discard the rest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375913#M110429</link>
      <description>&lt;P&gt;Your transforms.conf stanza should be this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[setparsing_myApp]
REGEX = (?i)(error|warn)
DEST_KEY = queue
FORMAT = indexQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can create a dedicated props.conf stanza for selected sources to ensure it's applied wherever you need. You can re-use your transforms.conf stanza as long as the source you're applying it to requires same regex/filtering rules.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 15:05:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375913#M110429</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-05-07T15:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Keep specific events and discard the rest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375914#M110430</link>
      <description>&lt;P&gt;Thank you for your quick response, I will test your stanza and let you know.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 15:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375914#M110430</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-05-07T15:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Keep specific events and discard the rest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375915#M110431</link>
      <description>&lt;P&gt;It works!  Thank you!!!&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 21:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Keep-specific-events-and-discard-the-rest/m-p/375915#M110431</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-05-08T21:36:09Z</dc:date>
    </item>
  </channel>
</rss>

