<?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: Filtering Events, Creating Custom Fields and Discarding Raw Data at index time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86244#M17929</link>
    <description>&lt;P&gt;Hi, you should normally not make index-time field extractions. Splunk advises against it. What you could do (possibly) is to remove everything after ",S:" via the SEDCMD parameter in props.conf, like so;&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[hostfile]
SEDCMD-shorten_events = s/,S:.*//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please do test this first, since it will throw away a large part of the events. Read more on the subject in;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/Data/Anonymizedatausingconfigurationfiles"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/Data/Anonymizedatausingconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, for the REPORT transform stanza, I don't think you'll need the 'DEST_KEY'.&lt;/P&gt;

&lt;P&gt;/K &lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2013 06:31:37 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2013-10-08T06:31:37Z</dc:date>
    <item>
      <title>Filtering Events, Creating Custom Fields and Discarding Raw Data at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86243#M17928</link>
      <description>&lt;P&gt;I'm attempting to minimize the amount of data Splunk indexes, but i'm dealing with very large log files. At the moment I can filter the events in these logs based on a regex search to only return the events that I need, however I'd like to shrink the indexed data even further, capturing only one field from the event. This is some contents from a typical log file:&lt;/P&gt;

&lt;P&gt;00:22:15.911 - M:ReadByID TradeMeOrganisationWorker,D:0ms,C:1,S:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;00:22:32.119 - M:ReadMultiple vwTMNewAutoListing,D:7427ms,C:0,S:   at LTI.Services.Concrete....&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;00:22:34.397 - M:ReadMultiple vwListingQuestion,D:32ms,C:0,S:&lt;/P&gt;

&lt;P&gt;The Bold event is the specific M type I'd like to capture (i.e. my Regex search is 'ReadMultiple vwTMNewAutoListing'), however the only information i'm interested in is the Duration (i.e. D:), and discard all the rest of the data - the S: field is a stack-trace and can be quite large.&lt;/P&gt;

&lt;P&gt;This is my current config:&lt;/P&gt;

&lt;P&gt;PROPS.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[hostfile]
pulldown_type = true
SHOULD_LINEMERGE = False
CHECK_FOR_HEADER = false
TRANSFORMS-set = setnull,newautolisting
REPORT-extract = durationMS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;TRANSFORMS.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[newautolisting]
REGEX = ReadMultiple vwTMNewAutoListing
FORMAT = indexQueue
DEST_KEY = queue

[durationMS]
REGEX = ReadMultiple vwTMNewAutoListing,D:(?&amp;lt;DurationMS&amp;gt;\d+)ms
FORMAT = DurationMS::$1
DEST_KEY = queue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, I'm sending all the events that do not match the Regex to Null, however the end result is I capture the complete Raw event that matches 'ReadMultiple vwTMNewAutoListing', plus I create the DurationMS field at search time. Is it possible to create the DurationMS field at index-time and discard the rest of the Raw event?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 02:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86243#M17928</guid>
      <dc:creator>tradevine</dc:creator>
      <dc:date>2013-10-08T02:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Events, Creating Custom Fields and Discarding Raw Data at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86244#M17929</link>
      <description>&lt;P&gt;Hi, you should normally not make index-time field extractions. Splunk advises against it. What you could do (possibly) is to remove everything after ",S:" via the SEDCMD parameter in props.conf, like so;&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[hostfile]
SEDCMD-shorten_events = s/,S:.*//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please do test this first, since it will throw away a large part of the events. Read more on the subject in;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/Data/Anonymizedatausingconfigurationfiles"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/Data/Anonymizedatausingconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, for the REPORT transform stanza, I don't think you'll need the 'DEST_KEY'.&lt;/P&gt;

&lt;P&gt;/K &lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 06:31:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86244#M17929</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-08T06:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Events, Creating Custom Fields and Discarding Raw Data at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86245#M17930</link>
      <description>&lt;P&gt;Excellent answer! I was attempting to use non-capturing groups and messing around with the syntax of the format. &lt;/P&gt;

&lt;P&gt;This works perfectly for me on the end of my props.conf entry for hostfile:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-trim_start = s/* - M://g
SEDCMD-trim_end = s/ms,C:.*//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2013 19:45:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86245#M17930</guid>
      <dc:creator>tradevine</dc:creator>
      <dc:date>2013-10-08T19:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Events, Creating Custom Fields and Discarding Raw Data at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86246#M17931</link>
      <description>&lt;P&gt;Excellent answer! I was attempting to use non-capturing groups and messing around with the syntax of the format. &lt;/P&gt;

&lt;P&gt;This works perfectly for me on the end of my props.conf entry for hostfile:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-trim_start = s/* - M://g
SEDCMD-trim_end = s/ms,C:.*//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Combined with my regex I've brought down my theoretical daily indexing on these particular logs from 1.8Gb (raw) to 4mb!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 19:46:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86246#M17931</guid>
      <dc:creator>tradevine</dc:creator>
      <dc:date>2013-10-08T19:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Events, Creating Custom Fields and Discarding Raw Data at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86247#M17932</link>
      <description>&lt;P&gt;Are you removing the timestamps from the events? I'd suggest you keep them (or has &lt;CODE&gt;_time&lt;/CODE&gt; already been assigned by the time SEDCMD kicks in?)&lt;/P&gt;

&lt;P&gt;I think your first SEDCMD should read;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;SEDCMD-trim_start = s/ - M://g&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 20:32:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-Events-Creating-Custom-Fields-and-Discarding-Raw-Data/m-p/86247#M17932</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-08T20:32:27Z</dc:date>
    </item>
  </channel>
</rss>

