<?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 Extract a Value from a Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498526#M194898</link>
    <description>&lt;P&gt;I have a situation where I have a defined field that has a large amount of data but I am interested in only one part of that field &lt;EM&gt;Status : 2&lt;/EM&gt;&lt;BR /&gt;
Apologies as I am new to Splunk and I am lower than elementary level on this, but how would I extract this value from the field? If rex, how would I set this query?&lt;/P&gt;

&lt;P&gt;= (garbage) Status : 2 (garbage)&lt;/P&gt;</description>
    <pubDate>Fri, 31 Jan 2020 02:56:22 GMT</pubDate>
    <dc:creator>joshy50</dc:creator>
    <dc:date>2020-01-31T02:56:22Z</dc:date>
    <item>
      <title>Extract a Value from a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498526#M194898</link>
      <description>&lt;P&gt;I have a situation where I have a defined field that has a large amount of data but I am interested in only one part of that field &lt;EM&gt;Status : 2&lt;/EM&gt;&lt;BR /&gt;
Apologies as I am new to Splunk and I am lower than elementary level on this, but how would I extract this value from the field? If rex, how would I set this query?&lt;/P&gt;

&lt;P&gt;= (garbage) Status : 2 (garbage)&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 02:56:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498526#M194898</guid>
      <dc:creator>joshy50</dc:creator>
      <dc:date>2020-01-31T02:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a Value from a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498527#M194899</link>
      <description>&lt;P&gt;@joshy50 ,&lt;/P&gt;

&lt;P&gt;Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"your search" 
|rex field=&amp;lt;your fieldname&amp;gt; "(?&amp;lt;status&amp;gt;Status : \d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jan 2020 09:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498527#M194899</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-01-31T09:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a Value from a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498528#M194900</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I believe you want to extract the value of the status field (i.e status = 2 then you want to extract 2 as the value of the status field) &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;If you want to go for regex expression. your expression would look like '&lt;STRONG&gt;'Status'\W+(?\d+)&lt;/STRONG&gt;'. Now that you have the regex expression. you can go to your splunk UI and there in the fields sidebar, scroll down you will see a '+' sign with "extract new fields"&amp;gt;&amp;gt; click on it. &lt;/LI&gt;
&lt;LI&gt; You will see the option as "I prefer writing my own regular expression" click on that. And put the above specified regex expression there. &lt;/LI&gt;
&lt;LI&gt;preview your extracted field&lt;/LI&gt;
&lt;LI&gt;click save &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;And then you would get an extracted field as "status" in the fields side bar.&lt;/P&gt;

&lt;P&gt;To know more about the regex expressions you can practice it here ----&amp;gt; "&lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 11:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498528#M194900</guid>
      <dc:creator>aditi25</dc:creator>
      <dc:date>2020-01-31T11:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract a Value from a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498529#M194901</link>
      <description>&lt;P&gt;What are possible values for status? Are they just digits?&lt;/P&gt;

&lt;P&gt;A helpful way to approach this is to identify what characters are NOT going to be in your status. For example, if status can contain anything and is always followed by a semicolon, then you can construct a class that captures everything except a semicolon.&lt;BR /&gt;
&lt;CODE&gt;| rex "Status\s:\s(?&amp;lt;status&amp;gt;[^;]+);"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Sometimes this is easier than trying to predict all possible legal values, and can help in cases where something unexpected is found (developer says "only digits" but you find a pound sign and become a hero).&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 14:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-a-Value-from-a-Field/m-p/498529#M194901</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-01-31T14:09:07Z</dc:date>
    </item>
  </channel>
</rss>

