<?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: How to only index events that contain specific fields? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244797#M47355</link>
    <description>&lt;P&gt;If you like, accept my answer.&lt;BR /&gt;
Thank you.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2016 13:45:15 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2016-11-23T13:45:15Z</dc:date>
    <item>
      <title>How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244784#M47342</link>
      <description>&lt;P&gt;Hello, all.&lt;/P&gt;

&lt;P&gt;I know that my question's not a unique, but I want to ask it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I have a netflow text log on a server with a universal forwarder installed. &lt;/P&gt;

&lt;P&gt;I don't want to index this entire log. I only want to index fields containing a certain key. For example, I can provide a few strings:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"timestamp":"2016-11-22T15:42:17.037821+0300","flow_id":268878859621513,"event_type":"netflow","src_ip":"11.11.11.11","src_port":22,"dest_ip":"22.22.22.22","dest_port":44206,"proto":"TCP","app_proto":"ssh","netflow":{"pkts":8,"bytes":2230,"start":"2016-11-22T15:41:14.611465+0300","end":"2016-11-22T15:41:14.638311+0300","age":0},"tcp":{"tcp_flags":"1a","syn":true,"psh":true,"ack":true}}
{"timestamp":"2016-11-22T15:44:18.013133+0300","flow_id":720902685008782,"event_type":"netflow","src_ip":"157.55.130.156","src_port":40032,"dest_ip":"22.22.22.22","dest_port":3166,"proto":"UDP","netflow":{"pkts":2,"bytes":126,"start":"2016-11-22T15:39:17.402318+0300","end":"2016-11-22T15:39:17.527073+0300","age":0}}
{"timestamp":"2016-11-22T15:44:16.025489+0300","flow_id":265292561318767,"event_type":"netflow","src_ip":"22.22.22.22","src_port":41979,"dest_ip":"33.33.33.33","dest_port":443,"proto":"TCP","app_proto":"tls","netflow":{"pkts":40,"bytes":14432,"start":"2016-11-22T15:41:05.983919+0300","end":"2016-11-22T15:43:14.286741+0300","age":129},"tcp":{"tcp_flags":"1b","syn":true,"fin":true,"psh":true,"ack":true}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, we have a different field - &lt;STRONG&gt;&lt;EM&gt;proto&lt;/EM&gt;&lt;/STRONG&gt; and &lt;STRONG&gt;&lt;EM&gt;app_proto&lt;/EM&gt;&lt;/STRONG&gt;. I only want to index data with these specific fields in Splunk. For example, I only need events with &lt;EM&gt;proto":"TCP"&lt;/EM&gt;, or maybe &lt;EM&gt;proto":"TCP"&lt;/EM&gt; and (or) &lt;EM&gt;app_proto":"ssh"&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;Can you help my with this case? I read the manual, but I can't understand the principle of the implementation of this.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 13:03:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244784#M47342</guid>
      <dc:creator>templier</dc:creator>
      <dc:date>2016-11-22T13:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244785#M47343</link>
      <description>&lt;P&gt;Hi templier,&lt;BR /&gt;
for my knowledge, you can filter your events discarding those events that don't contain your strings, but it isn't possible take only a part of each event that contains one of your strings.&lt;BR /&gt;
Every way to take only events that contain your strings, you have to configure:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [your_sourcetype]
 TRANSFORMS-set-nullqueue=set_nullqueue,set_OK
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [set_nullqueue]
 REGEX=.
 DEST_KEY=queue
 FORMAT=nullQueue

 [set_OK]
 REGEX=regex1|regex2|regex3
 DEST_KEY = queue
 FORMAT = indexQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 13:11:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244785#M47343</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-22T13:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244786#M47344</link>
      <description>&lt;P&gt;Hello, Giuseppe.&lt;BR /&gt;
Thx for you answer.&lt;/P&gt;

&lt;P&gt;Tried do this, my files:&lt;BR /&gt;
transforms.conf&lt;BR /&gt;
    [set_nullqueue]&lt;BR /&gt;
    REGEX=\S*UDP\S*&lt;BR /&gt;
    DEST_KEY=UDP&lt;BR /&gt;
    FORMAT=nullQueue&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_OK]
REGEX=\S*ssh\S*
DEST_KEY = queue
FORMAT = indexQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf unchanged, only set my sourcetype&lt;/P&gt;

&lt;P&gt;And nothing new in result. I write to indexer lines contained UDP&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244786#M47344</guid>
      <dc:creator>templier</dc:creator>
      <dc:date>2020-09-29T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244787#M47345</link>
      <description>&lt;P&gt;What do you mean when you say props.conf unchanged: Do you used my props.conf?&lt;/P&gt;

&lt;P&gt;Male this test inverting Order in TRANSFORMS command TRANSFORMS-set-nullqueue=set_OK,set_nullqueue&lt;/P&gt;

&lt;P&gt;Are you sure of your regex?&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:54:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244787#M47345</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T11:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244788#M47346</link>
      <description>&lt;P&gt;A space in regex is \s not \S, try replacing that.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 22:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244788#M47346</guid>
      <dc:creator>mrgibbon</dc:creator>
      <dc:date>2016-11-22T22:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244789#M47347</link>
      <description>&lt;P&gt;I test it on splunk field extraction - work great.&lt;BR /&gt;
Maybe solution in uninstall universal forwarder and install a heavy forwarder?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 09:36:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244789#M47347</guid>
      <dc:creator>templier</dc:creator>
      <dc:date>2016-11-23T09:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244790#M47348</link>
      <description>&lt;P&gt;Try, nothing new&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 09:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244790#M47348</guid>
      <dc:creator>templier</dc:creator>
      <dc:date>2016-11-23T09:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244791#M47349</link>
      <description>&lt;P&gt;Exactly, this needs to be done on a heavy forwarder.&lt;/P&gt;

&lt;P&gt;If interested, I would adjust the regular expression:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;transforms.conf
[setnull]
REGEX = (\"proto\":\"UDP\")
DEST_KEY = queue
FORMAT = nullQueue

[setok]
REGEX = (\"proto\":\"TCP\")|(\"app_proto\":\"ssh\")
DEST_KEY = queue
FORMAT = nullQueue

props.conf
[your_sourcetype]
TRANSFORMS-set = setnull, setok
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Rodrigo Ribeiro&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 10:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244791#M47349</guid>
      <dc:creator>rodrigorsilva</dc:creator>
      <dc:date>2016-11-23T10:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244792#M47350</link>
      <description>&lt;P&gt;Hi templier,&lt;BR /&gt;
Filtering using props.conf and transforms.conf it's a part of parsing phase done on your indexers.&lt;BR /&gt;
It isn't a good idea to use an heavy forwarder in all your servers!&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 10:46:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244792#M47350</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-23T10:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244793#M47351</link>
      <description>&lt;P&gt;Perfect Cusello.&lt;/P&gt;

&lt;P&gt;As informed by our colleague cusello, can be done by indexers, but in fact can not be done in a universal forwarder &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Tks&lt;/P&gt;

&lt;P&gt;Rodrigo Ribeiro&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 11:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244793#M47351</guid>
      <dc:creator>rodrigorsilva</dc:creator>
      <dc:date>2016-11-23T11:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244794#M47352</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
It's work.&lt;BR /&gt;
And now I have more experience in this theme.&lt;BR /&gt;
Can you to issue this post as an Answer, rather than a comment? I mark it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
Many thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 13:25:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244794#M47352</guid>
      <dc:creator>templier</dc:creator>
      <dc:date>2016-11-23T13:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244795#M47353</link>
      <description>&lt;P&gt;Yeap, thanks to you and Giuseppe for information and live example of this solution&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 13:27:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244795#M47353</guid>
      <dc:creator>templier</dc:creator>
      <dc:date>2016-11-23T13:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244796#M47354</link>
      <description>&lt;P&gt;Hi templier,&lt;BR /&gt;
Filtering using props.conf and transforms.conf it's a part of parsing phase done on your indexers.&lt;BR /&gt;
It isn't a good idea to use an heavy forwarder in all your servers!&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 13:44:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244796#M47354</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-23T13:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to only index events that contain specific fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244797#M47355</link>
      <description>&lt;P&gt;If you like, accept my answer.&lt;BR /&gt;
Thank you.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 13:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-only-index-events-that-contain-specific-fields/m-p/244797#M47355</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-23T13:45:15Z</dc:date>
    </item>
  </channel>
</rss>

