<?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: Field Extraction-- Grab 3 digits between fixed words in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115422#M30587</link>
    <description>&lt;P&gt;If the logger is in xml format then use&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | xmlkv | search StatusCode | table StatusCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;if its a normal logger,&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | rex field=_raw "(?&amp;lt;code&amp;gt;\d+)" | table StatusCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR try&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | rex field=_raw "(?&amp;lt;code&amp;gt;\d+)" | table StatusCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2015 19:40:35 GMT</pubDate>
    <dc:creator>regexcracker</dc:creator>
    <dc:date>2015-05-20T19:40:35Z</dc:date>
    <item>
      <title>Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115420#M30585</link>
      <description>&lt;P&gt;I have 3 different status codes which I need extracted, the words around them will be fixed and never change&lt;/P&gt;

&lt;P&gt;I will have 3 different status codes (200, 400, 0) &lt;/P&gt;

&lt;P&gt;So far I have &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^StatusCode&amp;gt;(?P&amp;lt;StatusCode&amp;gt;\d{1,3})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;It will always look like this&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;&amp;lt;a:StatusCode&amp;gt;200&amp;lt;/a:StatusCode&amp;gt;&lt;BR /&gt;
 &amp;lt;a:StatusCode&amp;gt;400&amp;lt;/a:StatusCode&amp;gt;&lt;BR /&gt;
 &amp;lt;a:StatusCode&amp;gt;0&amp;lt;/a:StatusCode&amp;gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 19:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115420#M30585</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-05-20T19:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115421#M30586</link>
      <description>&lt;P&gt;&lt;CODE&gt;rex "(?i)StatusCode\W(?P&amp;amp;lt;StatusCode&amp;amp;gt;.\d+)\W"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 19:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115421#M30586</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2015-05-20T19:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115422#M30587</link>
      <description>&lt;P&gt;If the logger is in xml format then use&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | xmlkv | search StatusCode | table StatusCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;if its a normal logger,&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | rex field=_raw "(?&amp;lt;code&amp;gt;\d+)" | table StatusCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR try&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | rex field=_raw "(?&amp;lt;code&amp;gt;\d+)" | table StatusCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 19:40:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115422#M30587</guid>
      <dc:creator>regexcracker</dc:creator>
      <dc:date>2015-05-20T19:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115423#M30588</link>
      <description>&lt;P&gt;Thanks for the reply. I need to extract a field so my team can use it at anytime. Any suggestions on the regex for extracting the field? &lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 20:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115423#M30588</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-05-20T20:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115424#M30589</link>
      <description>&lt;P&gt;Thanks for the reply. Nothing appeared when I put this in &lt;/P&gt;

&lt;P&gt;index=uvtrans ...| rex "(?i)StatusCode\W(?P&amp;lt;StatusCode&amp;gt;.\d+)\W"&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 20:15:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115424#M30589</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-05-20T20:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115425#M30590</link>
      <description>&lt;P&gt;In props.conf, under the stanza for this sourcetype (lets pretend it is called foo):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[foo]
EXTRACT-statuscode=^&amp;lt;a:StatusCode&amp;gt;(?&amp;lt;StatusCode&amp;gt;\d*)&amp;lt;/a:StatusCode&amp;gt;$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should do it. You might have to strip the anchors (either ^ or $) if the event doesn't always appear on a line by itself with no leading whitespace.&lt;/P&gt;

&lt;P&gt;The the event is 100% XML, you might try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[foo]
KV_MODE=xml
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2015 20:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115425#M30590</guid>
      <dc:creator>jacobwilkins</dc:creator>
      <dc:date>2015-05-20T20:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115426#M30591</link>
      <description>&lt;P&gt;here you go:   &lt;CODE&gt;..|rex field=_raw "\&amp;amp;lt;a\:StatusCode\&amp;amp;gt;(?&amp;amp;lt;statuscode&amp;amp;gt;\d+)\&amp;amp;lt;"|table statuscode&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 22:00:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115426#M30591</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-05-20T22:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115427#M30592</link>
      <description>&lt;P&gt;This worked perfectly! I didn't know you could extract in props.conf, that's good to know&lt;/P&gt;

&lt;P&gt;Can you elaborate on KV_MODE=xml?&lt;/P&gt;

&lt;P&gt;Thanks for your help!!&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2015 01:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115427#M30592</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-05-21T01:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction-- Grab 3 digits between fixed words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115428#M30593</link>
      <description>&lt;P&gt;from the docs on &lt;CODE&gt;props.conf&lt;/CODE&gt; &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Specifies the field/value extraction mode for the data.
* Set KV_MODE to one of the following:
    * xml : automatically extracts fields from XML data.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 May 2015 01:22:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Grab-3-digits-between-fixed-words/m-p/115428#M30593</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-05-21T01:22:13Z</dc:date>
    </item>
  </channel>
</rss>

