<?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: Dynamically extract field names from multiline event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92248#M23802</link>
    <description>&lt;P&gt;That is not completely true. Splunk applies the field extraction only to events that are pulled from the index - NOT all events in a sourcetype. So, if you're able to filter events before rex you should also be able to filter them as part of the first search. However, there are corner cases where the first search is not able to filter results before field extractions&lt;/P&gt;</description>
    <pubDate>Sat, 30 Apr 2011 23:15:00 GMT</pubDate>
    <dc:creator>Ledion_Bitincka</dc:creator>
    <dc:date>2011-04-30T23:15:00Z</dc:date>
    <item>
      <title>Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92242#M23796</link>
      <description>&lt;P&gt;I've got some log data that has a multi-line event this format:&lt;/P&gt;

&lt;P&gt;2011-04-28 11:40:00|ACTION|1304005199906869|stuff|stuff|stuff&lt;BR /&gt;&lt;BR /&gt;
SPARAM|1304005199906869|PartNumber|1613034&lt;BR /&gt;&lt;BR /&gt;
SPARAM|1304005199906869|OtherParameter|8528&lt;BR /&gt;&lt;BR /&gt;
SPARAM|1304005199906869|OtherParameter2|true  &lt;/P&gt;

&lt;P&gt;Thanks the the help of others on this forum, I can now pull each of the key-value pairs from the SPARAM rows, but I have to use one field extract per possible key:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | rex field=_raw "(?m-s)^SPARAM\|\d*\|PartNumber\|(?&amp;lt;SearchPartNumber&amp;gt;.*)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Is it possible to write one extract that would give me all the keys as different fields?  I've got about 20 possible keys, and I want to make this extract future-proof as well?&lt;/P&gt;

&lt;P&gt;Can I write something that will give me "PartNumber", "OtherParameter" and "OtherParameter2" as field names?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2011 17:00:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92242#M23796</guid>
      <dc:creator>frink</dc:creator>
      <dc:date>2011-04-29T17:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92243#M23797</link>
      <description>&lt;P&gt;A couple of things:&lt;/P&gt;

&lt;P&gt;(1) I would not recommend using rex to do field extractions (unless you're just testing stuff), but rather configure automatic field extraction in props/transforms.conf (maybe you're just testing ... )&lt;/P&gt;

&lt;P&gt;(2) you can extract field name and field value from the event (note that you cannot modify the field name as you're doing PartNumber -&amp;gt; SearchPartNumber though)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[my_sourcetype]
...
REPORT-fields = my_fields

transforms.conf
[my_fields]
REGEX = (?m-s)^SPARAM\|\d*\|([^|]+)\|(.*)
FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Apr 2011 17:41:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92243#M23797</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2011-04-29T17:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92244#M23798</link>
      <description>&lt;P&gt;Thanks for the quick response.  Is there a way to do it using rex?&lt;/P&gt;

&lt;P&gt;I'm not the administrator of this system so it will be more difficult for me to get the properties file changed (probably coming with a working proof of concept will help).&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2011 18:37:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92244#M23798</guid>
      <dc:creator>frink</dc:creator>
      <dc:date>2011-04-29T18:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92245#M23799</link>
      <description>&lt;P&gt;No, there is no way to do this with rex. However, you can configure field extractions from the Manage, if you're using 4.2 you should be able to configure the above via: &lt;BR /&gt;
Manager » Fields » Field transformations and &lt;BR /&gt;
Manager » Fields » Field extractions&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2011 18:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92245#M23799</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2011-04-29T18:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92246#M23800</link>
      <description>&lt;P&gt;Thanks, I'll give that a shot.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2011 19:23:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92246#M23800</guid>
      <dc:creator>frink</dc:creator>
      <dc:date>2011-04-29T19:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92247#M23801</link>
      <description>&lt;P&gt;Actually, there is benefit in using rex. If you configure automatic field extraction in props/transforms it will be applied by Splunk to every search result for that particular source type - and regular expressions can be very expensive.&lt;/P&gt;

&lt;P&gt;If you use rex, you can filter search so they are applied to a much smaller result set.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2011 10:39:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92247#M23801</guid>
      <dc:creator>bojanz</dc:creator>
      <dc:date>2011-04-30T10:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92248#M23802</link>
      <description>&lt;P&gt;That is not completely true. Splunk applies the field extraction only to events that are pulled from the index - NOT all events in a sourcetype. So, if you're able to filter events before rex you should also be able to filter them as part of the first search. However, there are corner cases where the first search is not able to filter results before field extractions&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2011 23:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92248#M23802</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2011-04-30T23:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically extract field names from multiline event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92249#M23803</link>
      <description>&lt;P&gt;another trick if you are experiencing performance issues, (I am find issues using the expanded-snare-syslog app) is to run the search in fast mode and add the fields you want. &lt;/P&gt;

&lt;P&gt;i.e. search | fields fieldA fieldB etc..&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2014 23:43:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-extract-field-names-from-multiline-event/m-p/92249#M23803</guid>
      <dc:creator>khourihan_splun</dc:creator>
      <dc:date>2014-04-18T23:43:50Z</dc:date>
    </item>
  </channel>
</rss>

