<?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: Need help in extracting value from a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152436#M42715</link>
    <description>&lt;P&gt;Thank you guys, that worked perfectly for me. This was a huge help&lt;/P&gt;</description>
    <pubDate>Fri, 27 Feb 2015 19:06:26 GMT</pubDate>
    <dc:creator>anoopambli</dc:creator>
    <dc:date>2015-02-27T19:06:26Z</dc:date>
    <item>
      <title>Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152431#M42710</link>
      <description>&lt;P&gt;i have tried whatever i could to get the desired output rex but not happening, please help.. &lt;BR /&gt;
This is what i am trying to do,&lt;/P&gt;

&lt;P&gt;I have a field which has values like below,&lt;/P&gt;

&lt;P&gt;OK: C: 10 OK: F: 19.13 OK: G: 0.57 13304 Fri Feb 27 06:39:52 2015 stopping 13304&lt;BR /&gt;
OK: C: 79.64 OK: E: 66.18 OK: F: 79.41 OK: G: 67.67 OK: H: 72.26 OK: I: 93.33 OK: J: 15.33 OK: K: 17.3 14104 Fri Feb 27 06:57:27 2015 stopping 14104&lt;BR /&gt;
OK: C: 54.57 OK: I: 6.98 OK: K: 0.99 OK: L: 69.21 17676 Fri Feb 27 06:57:19 2015 stopping 17676&lt;/P&gt;

&lt;P&gt;These are drive usage details of remote windows servers, i want to do a clean up on values on this field, ideally this is how it should look like&lt;/P&gt;

&lt;P&gt;C: 10 F:19.13 G:0.57&lt;BR /&gt;
C: 79.64 E: 66.18 F: 79.41 G: 67.67 H: 72.26  I: 93.33 J: 15.33 K: 17.3&lt;BR /&gt;
C: 54.57 I: 6.98  K: 0.99  L: 69.21&lt;/P&gt;

&lt;P&gt;Any idea how i can accomplish this?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 11:59:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152431#M42710</guid>
      <dc:creator>anoopambli</dc:creator>
      <dc:date>2015-02-27T11:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152432#M42711</link>
      <description>&lt;P&gt;This worked for me with your sample data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=0 field=foo "(?:OK: (?P&amp;lt;drive&amp;gt;\w:)\s(?P&amp;lt;usage&amp;gt;[\.\d]+))+" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Feb 2015 12:52:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152432#M42711</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-02-27T12:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152433#M42712</link>
      <description>&lt;P&gt;Thank you for your response. I think we are almost there. With the query given it is creating two fields, one for the drive name and another for the usage. That is perfectly fine, but only thing i noticed is that i am getting only one drive usage. Do i need to do anything to match all others the similar way?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 13:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152433#M42712</guid>
      <dc:creator>anoopambli</dc:creator>
      <dc:date>2015-02-27T13:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152434#M42713</link>
      <description>&lt;P&gt;I neglected to mention rex would extract the fields as multi-valued fields.  Use mvexpand to see all values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=0 field=foo "(?:OK: (?P&amp;lt;drive&amp;gt;\w:)\s(?P&amp;lt;usage&amp;gt;[\.\d]+))+" | mvexpand drive | mvexpand usage | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Feb 2015 15:01:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152434#M42713</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-02-27T15:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152435#M42714</link>
      <description>&lt;P&gt;If you just want to get a field that has the whole set of drive usage stats, you don't need to use rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yoursearch&amp;gt; | eval driveusage=replace (_raw, "OK:\s(\w:)", "\\1") | eval driveinfo=replace(driveusage, "\d+\s\w{3}\s\w{3}\s\d\d\s\d\d:.*$", "")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is likely to work on all your data and returns the entire string that you want into a single field called &lt;STRONG&gt;driveusage&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 16:34:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152435#M42714</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2015-02-27T16:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152436#M42715</link>
      <description>&lt;P&gt;Thank you guys, that worked perfectly for me. This was a huge help&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 19:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152436#M42715</guid>
      <dc:creator>anoopambli</dc:creator>
      <dc:date>2015-02-27T19:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152437#M42716</link>
      <description>&lt;P&gt;If you want to separate them into each drive being in a different field, you have a bit of a problem, because you have a variable number of the drives in each line. The &lt;CODE&gt;mvexpand&lt;/CODE&gt; that &lt;EM&gt;richgalloway&lt;/EM&gt; suggests will let you separate the values by drive. In your original post you said that you wanted to clean up the data, which is what my &lt;CODE&gt;eval&lt;/CODE&gt; commands do to produce the line with only the values that you wanted in the single result. What is the point of "cleaning up?" Do you want to extract each drive's value and do statistics on it, or are you just doing a report of the data for a given system, or is there something else that you want to do?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 21:54:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152437#M42716</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2015-02-27T21:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in extracting value from a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152438#M42717</link>
      <description>&lt;P&gt;I was trying to build a table where it shows the hostname then it's curresponding drives and usage. The query with richgalloway shows different drives but when i table them it is not showing all the drives and the usage association is coming up wrong. While using mvexpand, would there be any problem in associating name and value....?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2015 10:32:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-in-extracting-value-from-a-field/m-p/152438#M42717</guid>
      <dc:creator>anoopambli</dc:creator>
      <dc:date>2015-03-02T10:32:17Z</dc:date>
    </item>
  </channel>
</rss>

