<?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 How to extract fields from events where the field location isn't constant and keeps changing? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342264#M101395</link>
    <description>&lt;P&gt;I want to write a query or rex under field extraction, to extract each value following a string and stopping at coma, &lt;/P&gt;

&lt;P&gt;example : &lt;BR /&gt;
 hcyycuvubuv : 45544.466, "cpu percentage" :23.45667, "higghh": 23.345t,&lt;/P&gt;

&lt;P&gt;in above string, I am only  looking for numbers that come after  "cpu_percentage":&lt;BR /&gt;
, which is &lt;STRONG&gt;23.45667&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;problem is, in my events the cpu percentage string is not at the same location in logs.&lt;/P&gt;

&lt;P&gt;example : &lt;/P&gt;

&lt;P&gt;first event&lt;BR /&gt;
 chhchvhvh: 223. 455, "cpu_percentage":23.45677,gghffvhh:3455&lt;/P&gt;

&lt;P&gt;second event &lt;BR /&gt;
 chhchvhvh: 223. 455, tuvjvujjvg:3456.566,  "cpu_percentage":23.45677,gghffvhh:3455.788&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 17:04:33 GMT</pubDate>
    <dc:creator>VI371887</dc:creator>
    <dc:date>2018-03-08T17:04:33Z</dc:date>
    <item>
      <title>How to extract fields from events where the field location isn't constant and keeps changing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342264#M101395</link>
      <description>&lt;P&gt;I want to write a query or rex under field extraction, to extract each value following a string and stopping at coma, &lt;/P&gt;

&lt;P&gt;example : &lt;BR /&gt;
 hcyycuvubuv : 45544.466, "cpu percentage" :23.45667, "higghh": 23.345t,&lt;/P&gt;

&lt;P&gt;in above string, I am only  looking for numbers that come after  "cpu_percentage":&lt;BR /&gt;
, which is &lt;STRONG&gt;23.45667&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;problem is, in my events the cpu percentage string is not at the same location in logs.&lt;/P&gt;

&lt;P&gt;example : &lt;/P&gt;

&lt;P&gt;first event&lt;BR /&gt;
 chhchvhvh: 223. 455, "cpu_percentage":23.45677,gghffvhh:3455&lt;/P&gt;

&lt;P&gt;second event &lt;BR /&gt;
 chhchvhvh: 223. 455, tuvjvujjvg:3456.566,  "cpu_percentage":23.45677,gghffvhh:3455.788&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 17:04:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342264#M101395</guid>
      <dc:creator>VI371887</dc:creator>
      <dc:date>2018-03-08T17:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from events where the field location isn't constant and keeps changing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342265#M101396</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search 
| rex "\"cpu_percentage\"\:(?&amp;lt;cpu_percentage&amp;gt;[^,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| extract pairdelim="," kvdelim=":"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Mar 2018 17:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342265#M101396</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-03-08T17:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from events where the field location isn't constant and keeps changing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342266#M101397</link>
      <description>&lt;P&gt;Hey VI371887,&lt;/P&gt;

&lt;P&gt;You can try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search|rex field=_raw "\"cpu_percentage\"\:(?P&amp;lt;percentage&amp;gt;\d+.\d+[^,])" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if this helps!!!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 17:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342266#M101397</guid>
      <dc:creator>deepashri_123</dc:creator>
      <dc:date>2018-03-08T17:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from events where the field location isn't constant and keeps changing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342267#M101398</link>
      <description>&lt;P&gt;Hi VI371887,&lt;/P&gt;

&lt;P&gt;Try this run search anywhere..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval data="\"disk_bytes\":23.10,\"disk_bytes_quota\":23.13t," | rex field=data "disk_bytes\"\:(?&amp;lt;disk_bytes&amp;gt;\d+\.\d*)\,\"disk_bytes_quota\"\:(?&amp;lt;disk_bytes_quota&amp;gt;\d+\.\w+)\,"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in your environment:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search |  rex field=_raw "disk_bytes\"\:(?&amp;lt;disk_bytes&amp;gt;\d+\.\d*)\,\"disk_bytes_quota\"\:(?&amp;lt;disk_bytes_quota&amp;gt;\d+\.\w+)\,"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | rex field=data "disk_bytes\"\:(?&amp;lt;disk_bytes&amp;gt;[^,]+)\,\"disk_bytes_quota\"\:(?&amp;lt;disk_bytes_quota&amp;gt;[^,]+)\,"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:01:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342267#M101398</guid>
      <dc:creator>anjambha</dc:creator>
      <dc:date>2018-03-09T07:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from events where the field location isn't constant and keeps changing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342268#M101399</link>
      <description>&lt;P&gt;hi i am having similar issues,&lt;/P&gt;

&lt;P&gt;with msg field&lt;/P&gt;

&lt;P&gt;it's has different values can be numbers, strings, path, punctuations, blank space like shown below.&lt;/P&gt;

&lt;P&gt;"msg" :"35556"&lt;BR /&gt;
"msg" :"&amp;lt;&amp;lt;÷] {&amp;lt;} ;;"&lt;BR /&gt;
"msg" :"ycuvuuu jvbigg buivuv"&lt;BR /&gt;
"msg" :" "&lt;/P&gt;

&lt;P&gt;now problem is, i have written rex as&lt;BR /&gt;
\msg\":(? \". *\") \,&lt;/P&gt;

&lt;P&gt;but it returns value which following msg field.&lt;/P&gt;

&lt;P&gt;"msg" :"vjvuv igivc uvviv", "origin" :"abcgc", "time" :23.45677", &lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 06:36:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-events-where-the-field-location-isn-t/m-p/342268#M101399</guid>
      <dc:creator>VI371887</dc:creator>
      <dc:date>2018-03-21T06:36:50Z</dc:date>
    </item>
  </channel>
</rss>

