<?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 parse out fields in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444984#M77460</link>
    <description>&lt;P&gt;You will have to stack a &lt;CODE&gt;calculated field&lt;/CODE&gt; on top of this using &lt;CODE&gt;lower(fieldname)&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2019 23:22:11 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-06-07T23:22:11Z</dc:date>
    <item>
      <title>How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444971#M77447</link>
      <description>&lt;P&gt;Hi, I have an XML-like (but not proper XML) feed that I need to parse.&lt;BR /&gt;&lt;BR /&gt;
A sample is below, and I need to parse out each field.&lt;BR /&gt;&lt;BR /&gt;
Each field will not necessarily be in each event, so I need a method that will find it, without depending upon a previous field or the location within the event itself.&lt;BR /&gt;&lt;BR /&gt;
Can anyone help?  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Apr 22 19:54:29 138.126.78.80 &amp;lt;STONEGATE_LOG&amp;gt;&amp;lt;TIMESTAMP&amp;gt;2019-04-22 15:54:28&amp;lt;/TIMESTAMP&amp;gt;&amp;lt;LOGID&amp;gt;9999999&amp;lt;/LOGID&amp;gt;&amp;lt;NODEID&amp;gt;1.2.3.4&amp;lt;/NODEID&amp;gt;&amp;lt;FACILITY&amp;gt;Packet Filtering&amp;lt;/FACILITY&amp;gt;&amp;lt;TYPE&amp;gt;Notification&amp;lt;/TYPE&amp;gt;&amp;lt;EVENT&amp;gt;New connection&amp;lt;/EVENT&amp;gt;&amp;lt;ACTION&amp;gt;Allow&amp;lt;/ACTION&amp;gt;&amp;lt;SRC&amp;gt;4.5.6.7&amp;lt;/SRC&amp;gt;&amp;lt;DST&amp;gt;X.X.X.X&amp;lt;/DST&amp;gt;&amp;lt;SERVICE&amp;gt;HTTP&amp;lt;/SERVICE&amp;gt;&amp;lt;PROTOCOL&amp;gt;2&amp;lt;/PROTOCOL&amp;gt;&amp;lt;SPORT&amp;gt;12345&amp;lt;/SPORT&amp;gt;&amp;lt;DPORT&amp;gt;99&amp;lt;/DPORT&amp;gt;&amp;lt;RULEID&amp;gt;60732.1&amp;lt;/RULEID&amp;gt;&amp;lt;SRCIF&amp;gt;5&amp;lt;/SRCIF&amp;gt;&amp;lt;COMPID&amp;gt;some text here&amp;lt;/COMPID&amp;gt;&amp;lt;RECEPTIONTIME&amp;gt;2019-04-22 15:54:29&amp;lt;/RECEPTIONTIME&amp;gt;&amp;lt;SENDERTYPE&amp;gt;Firewall&amp;lt;/SENDERTYPE&amp;gt;&amp;lt;SITUATION&amp;gt;Connection_Allowed&amp;lt;/SITUATION&amp;gt;&amp;lt;EVENTID&amp;gt;99999999999&amp;lt;/EVENTID&amp;gt;&amp;lt;/STONEGATE_LOG&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2019 18:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444971#M77447</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-05-01T18:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444972#M77448</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;To extract XML data at search time, you can use below config on Search Head.&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yourSourcetype]
REPORT-test = xmlkv_alt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[xmlkv_alt]
FORMAT = $1::$2
REGEX = &amp;lt;([^&amp;gt;]*)&amp;gt;([^&amp;lt;]*)&amp;lt;\/\1&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: Please find regex extraction with sample data on &lt;A href="https://regex101.com/r/tJVD20/1"&gt;https://regex101.com/r/tJVD20/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 19:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444972#M77448</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-01T19:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444973#M77449</link>
      <description>&lt;P&gt;Thanks.  I see them appearing on the regex site, but they don't appear as fields on the SH when I try that - are there additional steps requried? &lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 19:43:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444973#M77449</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-05-01T19:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444974#M77450</link>
      <description>&lt;P&gt;If you modified config file directly then you need to restart splunk service or you can use /debug/refresh web endpoint &lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 20:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444974#M77450</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-01T20:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444975#M77451</link>
      <description>&lt;P&gt;Interesting, so the xml doesn't have to be well-formed, as the sample above isn't well-formed.  &lt;/P&gt;

&lt;P&gt;Amazing, because back-then, a similar solution for json was a big hit here - &lt;A href="https://answers.splunk.com/answers/581928/how-can-we-extract-a-json-document-within-an-event.html"&gt;How can we extract a json document within an event?&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;We ended up with - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REPORT-extract = json_embedded


[json_embedded]
REGEX = "(\w+)"."(\S+?)"
FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2019 20:08:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444975#M77451</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2019-05-01T20:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444976#M77452</link>
      <description>&lt;P&gt;How will the fields appear?  Will they automatically appear with the names? &lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 20:17:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444976#M77452</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-05-01T20:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444977#M77453</link>
      <description>&lt;P&gt;Yes it will automatically appear, I have tested this config in my lab and it is working fine.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 20:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444977#M77453</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-01T20:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444978#M77454</link>
      <description>&lt;P&gt;All these answers are missing this setting in transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the full stanza is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourNameHere]
REGEX = &amp;lt;([^\/][^&amp;gt;]+)&amp;gt;(.*?)&amp;lt;\/[^&amp;gt;]+&amp;gt;
FORMAT = $1::$2
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 May 2019 01:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444978#M77454</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-02T01:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444979#M77455</link>
      <description>&lt;P&gt;This will not work because &lt;CODE&gt;REPEAT_MATCH&lt;/CODE&gt; is only valid for Indexed-time field extraction and solution which I have provided is for search time extraction.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 05:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444979#M77455</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-02T05:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444980#M77456</link>
      <description>&lt;P&gt;Quite correct; I always get &lt;CODE&gt;MV_ADD&lt;/CODE&gt; and &lt;CODE&gt;REPEAT_MATCH&lt;/CODE&gt; confused.  I have corrected my answer.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 05:30:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444980#M77456</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-02T05:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444981#M77457</link>
      <description>&lt;P&gt;Yes you can use regex for magic &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 08:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444981#M77457</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-02T08:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444982#M77458</link>
      <description>&lt;P&gt;Thanks.  This works quite well.  Is there anyway of forcing field names to be lowercase?  &lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 17:35:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444982#M77458</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-05-06T17:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444983#M77459</link>
      <description>&lt;P&gt;I expect that a props.conf entry for &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/CreatecalculatedfieldswithSplunkWeb"&gt;calculated field&lt;/A&gt; would work with eval's &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/TextFunctions#lower.28X.29"&gt;lower()&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 13:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444983#M77459</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2019-06-07T13:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444984#M77460</link>
      <description>&lt;P&gt;You will have to stack a &lt;CODE&gt;calculated field&lt;/CODE&gt; on top of this using &lt;CODE&gt;lower(fieldname)&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 23:22:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-fields/m-p/444984#M77460</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-07T23:22:11Z</dc:date>
    </item>
  </channel>
</rss>

