<?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 extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110814#M28990</link>
    <description>&lt;P&gt;It worked.  Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2015 19:34:28 GMT</pubDate>
    <dc:creator>tlbj6142</dc:creator>
    <dc:date>2015-01-23T19:34:28Z</dc:date>
    <item>
      <title>How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110810#M28986</link>
      <description>&lt;P&gt;Most of the time we use a shared report ("General Product Report") to view our logs for sourcetype="product".  I created a field extraction rule to parse each entry into 7-8 fields (the sample below has been trimmed down for brevity).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?P&amp;lt;ts&amp;gt;.{23})\s(?P&amp;lt;level&amp;gt;[A-Z]{4,6})\s+\[\s*(?P&amp;lt;tid&amp;gt;.+)\]\s+:-&amp;gt;\s(?P&amp;lt;body&amp;gt;.*)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to create another shared report "Product Performance Report" that parses the same sourcetype differently as roughly 30% of the entries in product log contain performance data that we would like to chart.  This extraction pulls out the 'duration' and 'url' fields from those entries.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?P&amp;lt;ts&amp;gt;.{23})\s(?P&amp;lt;level&amp;gt;[A-Z]{4,6})\s+\[\s*(?P&amp;lt;tid&amp;gt;.+)\]\s+:-&amp;gt;\s\-\-Done\s\[(?P&amp;lt;dur&amp;gt;.*)\]\s\[(?P&amp;lt;url&amp;gt;.*)\].*$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I apply the 2nd extraction 'rule' to the same sourcetype but only use it when viewing the "Performance Report"?  Is there a better approach to get the same results?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Sample Entries:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-01-23 00:02:06,161 INFO   [ 68] :-&amp;gt; foo bar
2015-01-23 00:02:26,177 INFO   [ 65] :-&amp;gt; --Done [   15.581] [http://the.url.org/mickey/mouse]
2015-01-23 00:02:36,302 INFO   [ 65] :-&amp;gt; bla bla bla
2015-01-23 00:02:36,349 INFO   [ 65] :-&amp;gt; --Done [  203.111] [http://the.url.org/donald/duck]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jan 2015 18:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110810#M28986</guid>
      <dc:creator>tlbj6142</dc:creator>
      <dc:date>2015-01-23T18:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110811#M28987</link>
      <description>&lt;P&gt;The field extraction is done at sourcetype level so I am not sure if you can conditionally choose which field extractions to use. What I would suggest is the define two field extractiosn stanza, for your sourcetype.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Props.conf in Search Head
[product]
EXTRACT-general = ^(?P&amp;lt;ts&amp;gt;.{23})\s(?P&amp;lt;level&amp;gt;[A-Z]{4,6})\s+\[\s*(?P&amp;lt;tid&amp;gt;.+)\]\s+:-&amp;gt;\s(?P&amp;lt;body&amp;gt;.*)$
EXTRACT-perf = :-&amp;gt;\s\-\-Done\s\[(?P&amp;lt;dur&amp;gt;.*)\]\s\[(?P&amp;lt;url&amp;gt;.*)\].*$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should create fields ts, level,tid, body for all events. It will also create dur and url for all events but for non performance data, they would be null. So, for General report your just refer fields ts, level,tid, body and for Performance report, just use fields ts, level,tid, dur, url.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 18:53:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110811#M28987</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-23T18:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110812#M28988</link>
      <description>&lt;P&gt;Thanks.  That makes some sense.  I'll give that a try.  Can I do that through the admin UI?  My operation's staff doesn't give me direct access to props.conf.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:10:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110812#M28988</guid>
      <dc:creator>tlbj6142</dc:creator>
      <dc:date>2015-01-23T19:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110813#M28989</link>
      <description>&lt;P&gt;Yes, You can add field extraction through Splunk Web's admin pages. &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/Knowledge/Managesearch-timefieldextractions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/Knowledge/Managesearch-timefieldextractions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:13:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110813#M28989</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-23T19:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110814#M28990</link>
      <description>&lt;P&gt;It worked.  Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:34:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110814#M28990</guid>
      <dc:creator>tlbj6142</dc:creator>
      <dc:date>2015-01-23T19:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110815#M28991</link>
      <description>&lt;P&gt;Make your comment an 'answer' so I can mark the question as answered.  Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110815#M28991</guid>
      <dc:creator>tlbj6142</dc:creator>
      <dc:date>2015-01-23T19:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract 2 different sets of fields for the same sourcetype, but only use each set when viewed in 2 separate reports?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110816#M28992</link>
      <description>&lt;P&gt;Glad it helped. Here you go.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:41:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-2-different-sets-of-fields-for-the-same/m-p/110816#M28992</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-23T19:41:14Z</dc:date>
    </item>
  </channel>
</rss>

