<?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 Filtering fields in log before forward to indexing in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150519#M30598</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
If i need to filtering some data in the log before forward to indexing, how to go abt doing it? thks&lt;/P&gt;</description>
    <pubDate>Fri, 14 Feb 2014 03:50:59 GMT</pubDate>
    <dc:creator>SplunkCSIT</dc:creator>
    <dc:date>2014-02-14T03:50:59Z</dc:date>
    <item>
      <title>Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150519#M30598</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
If i need to filtering some data in the log before forward to indexing, how to go abt doing it? thks&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2014 03:50:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150519#M30598</guid>
      <dc:creator>SplunkCSIT</dc:creator>
      <dc:date>2014-02-14T03:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150520#M30599</link>
      <description>&lt;P&gt;If you want to avoid indexing part of an event, you should look into using a SED entry in your &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/admin/Propsconf"&gt;props.conf&lt;/A&gt; file. You would need a regular expression matching the portion of the data you want to remove, then in your props.conf, you have an entry like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysourcetype]
SED-remove_data = s/&amp;lt;your regex here&amp;gt;//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want that to occur before the data is sent over the network, that would need to be done on a heavy forwarder, or another parsing system. Note that the SED entry is done at index time, so it would need to be on your indexers or other parsing systems.&lt;/P&gt;

&lt;P&gt;HTH,&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2014 05:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150520#M30599</guid>
      <dc:creator>dshpritz</dc:creator>
      <dc:date>2014-02-14T05:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150521#M30600</link>
      <description>&lt;P&gt;If i want to forward the below xml file to index, but before forward to index, i want the data field and values (&lt;DATA&gt;this is the data i want only&lt;/DATA&gt;)to be forwarded and the rest to be filter off, how to configure in the props.conf? thks&lt;/P&gt;

&lt;P&gt;file.xml&lt;BR /&gt;
&lt;TEXT extractor=""&gt; testing &lt;/TEXT&gt;&lt;BR /&gt;
&lt;COMMENTS&gt;focusing on the inputs&lt;/COMMENTS&gt;&lt;BR /&gt;
&lt;DATA&gt;this is the data i want only&lt;/DATA&gt;&lt;BR /&gt;
&lt;REMARKS&gt;this problem&lt;/REMARKS&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2014 03:58:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150521#M30600</guid>
      <dc:creator>SplunkCSIT</dc:creator>
      <dc:date>2014-02-15T03:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150522#M30601</link>
      <description>&lt;P&gt;If i want to forward the below xml file to index, but before forward to index, i want the data field and values (&lt;DATA&gt;this is the data i want only&lt;/DATA&gt;)to be forwarded and the rest to be filter off, how to configure in the props.conf? thks&lt;/P&gt;

&lt;P&gt;file.xml &lt;TEXT extractor=""&gt; testing &lt;/TEXT&gt; &lt;COMMENTS&gt;focusing on the inputs&lt;/COMMENTS&gt; &lt;DATA&gt;this is the data i want only&lt;/DATA&gt; &lt;REMARKS&gt;this problem&lt;/REMARKS&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2014 07:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150522#M30601</guid>
      <dc:creator>SplunkCSIT</dc:creator>
      <dc:date>2014-02-17T07:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150523#M30602</link>
      <description>&lt;P&gt;In this case, you can run two SED commands, one to stip away what is in front of &lt;DATA&gt; and one for after &lt;/DATA&gt;:&lt;/P&gt;

&lt;P&gt;SED-remove_before = s/(?s).*(?=&lt;DATA&gt;)//g&lt;BR /&gt;
SED-remove_after = s/(?s)(?&amp;lt;=&lt;/DATA&gt;).*//g&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2014 07:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150523#M30602</guid>
      <dc:creator>dshpritz</dc:creator>
      <dc:date>2014-02-17T07:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150524#M30603</link>
      <description>&lt;P&gt;thks for the valuable info, where will SED command be implement, at forwarder or the indexer and at which file? thks&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2014 13:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150524#M30603</guid>
      <dc:creator>SplunkCSIT</dc:creator>
      <dc:date>2014-02-18T13:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150525#M30604</link>
      <description>&lt;P&gt;read Dave's answer and you find every information you need &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2014 14:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150525#M30604</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-02-18T14:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150526#M30605</link>
      <description>&lt;P&gt;There's a page of documentation dedicated to just this question:  &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/Forwarding/Routeandfilterdatad"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.1/Forwarding/Routeandfilterdatad&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you want to filter &lt;EM&gt;before&lt;/EM&gt; forwarding, you have to use a heavy forwarder.  The reason for this is that a light forwarder doesn't use transforms.conf and therefore does very limited parsing of the source data before sending it on.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Discard specific events and keep the rest&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;This example discards all sshd events in /var/log/messages by sending them to nullQueue:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;In props.conf, set the TRANSFORMS-null attribute:&lt;/P&gt;

&lt;P&gt;[source::/var/log/messages]&lt;BR /&gt;
TRANSFORMS-null= setnull&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Create a corresponding stanza in transforms.conf. Set DEST_KEY to "queue" and FORMAT to "nullQueue":&lt;/P&gt;

&lt;P&gt;[setnull]&lt;BR /&gt;
REGEX = [sshd]&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = nullQueue&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;That does it.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Keep specific events and discard the rest&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Here's the opposite scenario. In this example, you use two transforms to keep only the sshd events. One transform routes sshd events to indexQueue, while another routes all other events to nullQueue.&lt;/P&gt;

&lt;P&gt;Note: In this example, the order of the transforms in props.conf matters. The null queue transform must come first; if it comes later, it will invalidate the previous transform and route all events to the null queue.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;In props.conf:&lt;/P&gt;

&lt;P&gt;[source::/var/log/messages]&lt;BR /&gt;
TRANSFORMS-set= setnull,setparsing&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;In transforms.conf:&lt;/P&gt;

&lt;P&gt;[setnull]&lt;BR /&gt;
REGEX = .&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = nullQueue&lt;/P&gt;

&lt;P&gt;[setparsing]&lt;BR /&gt;
REGEX = [sshd]&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Alternatively, you can use SED command processing to replace all text in a given line with nothing (s/something//).  Splunk doesn't support SED delete line commands, but it &lt;EM&gt;shouldn't&lt;/EM&gt; index blank lines, so replacing a line of text with nothing should do it.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2014 14:54:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150526#M30605</guid>
      <dc:creator>thesteve</dc:creator>
      <dc:date>2014-02-18T14:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150527#M30606</link>
      <description>&lt;P&gt;The SED command goes into the props.conf file on the first parsing system (indexer or heavy forwarder).&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2014 17:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150527#M30606</guid>
      <dc:creator>dshpritz</dc:creator>
      <dc:date>2014-02-18T17:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150528#M30607</link>
      <description>&lt;P&gt;Good answer, but I'm not sure it fits the use case. He doesn't want to filter entire events (nullQueue) but wants to strip out most of the event, and leave parts.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2014 17:34:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150528#M30607</guid>
      <dc:creator>dshpritz</dc:creator>
      <dc:date>2014-02-18T17:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150529#M30608</link>
      <description>&lt;P&gt;Sorry for these silly question, I'm new to SED modification. 1) This doesn't seem to be working for me (I'm using splunk 6.2 on Windows) which leads me to 2) where do I find doc on remove_data, remove_before or remove_after?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150529#M30608</guid>
      <dc:creator>mmsull4</dc:creator>
      <dc:date>2020-09-28T18:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering fields in log before forward to indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150530#M30609</link>
      <description>&lt;P&gt;Hi. Are these features also available in Splunk Light (version 6.5.1)?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 11:54:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-fields-in-log-before-forward-to-indexing/m-p/150530#M30609</guid>
      <dc:creator>mdzmuran</dc:creator>
      <dc:date>2017-06-19T11:54:38Z</dc:date>
    </item>
  </channel>
</rss>

