<?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: Can you help me get multiple fields from a single field in JSON? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431658#M75530</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you try the below search, the idea is to create those fields using rex.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;your index&amp;gt;
|  rex field=Text normalSliceUsage=(?&amp;lt;normalSliceUsage&amp;gt;\d+\.\d+%)\s+\*\s+totalWeightUsage=(?&amp;lt;totalWeightUsage&amp;gt;\d\.\d{2})\s+\*\s+userCount=(?&amp;lt;userCount&amp;gt;\d+)\s+\*\s+clinicalUserCount=(?&amp;lt;clinicalUserCount&amp;gt;\d+)\s+\*\s+AvgCPUUsage=(?&amp;lt;AvgCPUUsage&amp;gt;\d+\.\d+%)\s+\*\s+AvailableMemory=(?&amp;lt;AvailableMemory&amp;gt;\d+MB)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can checkout the how the rex working in the below site,&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;in the test string give the below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;*** Environment changed due to [Average CPU ] : normalSliceUsage=0.00% * totalWeightUsage=0.00 * userCount=0 * clinicalUserCount=0 * AvgCPUUsage=9.97% * AvailableMemory=6458MB ***
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the regex give the below regex,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; normalSliceUsage=(?&amp;lt;normalSliceUsage&amp;gt;\d+\.\d+%)\s+\*\s+totalWeightUsage=(?&amp;lt;totalWeightUsage&amp;gt;\d\.\d{2})\s+\*\s+userCount=(?&amp;lt;userCount&amp;gt;\d+)\s+\*\s+clinicalUserCount=(?&amp;lt;clinicalUserCount&amp;gt;\d+)\s+\*\s+AvgCPUUsage=(?&amp;lt;AvgCPUUsage&amp;gt;\d+\.\d+%)\s+\*\s+AvailableMemory=(?&amp;lt;AvailableMemory&amp;gt;\d+MB)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Dec 2018 08:58:52 GMT</pubDate>
    <dc:creator>sdchakraborty</dc:creator>
    <dc:date>2018-12-10T08:58:52Z</dc:date>
    <item>
      <title>Can you help me get multiple fields from a single field in JSON?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431655#M75527</link>
      <description>&lt;P&gt;The text field in my event contains A LOT of data.&lt;/P&gt;

&lt;P&gt;json snipped :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"Date":"2018-12-05T12:04:04.71","ID":"00000000-0000-0000-0000-000000000000","Text":"*** Environment changed due to [Average CPU ] : normalSliceUsage=0.00% * totalWeightUsage=0.00 * userCount=0 * clinicalUserCount=0 * AvgCPUUsage=9.97% * AvailableMemory=6458MB ***} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What i'm trying to do is write a search that will get all values of on/all fields.&lt;/P&gt;

&lt;P&gt;i.e. "get all values of  userCount"&lt;/P&gt;

&lt;P&gt;i have had some progress using eval and split &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval values=split(Text," * ") |
eval temp=mvindex(values,0)|
eval temp=split(temp,"=")|eval temp=mvindex(temp,1)|convert rmunit(temp)|    
eval normalSliceUsage=temp| table Date normalSliceUsage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Dec 2018 06:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431655#M75527</guid>
      <dc:creator>danw25</dc:creator>
      <dc:date>2018-12-09T06:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me get multiple fields from a single field in JSON?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431656#M75528</link>
      <description>&lt;P&gt;Does one event in Splunk contain multiple lines of text or only one line?&lt;BR /&gt;
When you search for your events in Splunk, is the field "userCount" available on the left side?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 16:09:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431656#M75528</guid>
      <dc:creator>whrg</dc:creator>
      <dc:date>2018-12-09T16:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me get multiple fields from a single field in JSON?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431657#M75529</link>
      <description>&lt;P&gt;I guess Splunk should auto-extract field values when they are in foo=bar format, check your interesting fields for userCount, if not pls post a snippet of your json data.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 17:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431657#M75529</guid>
      <dc:creator>prakash007</dc:creator>
      <dc:date>2018-12-09T17:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me get multiple fields from a single field in JSON?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431658#M75530</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you try the below search, the idea is to create those fields using rex.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;your index&amp;gt;
|  rex field=Text normalSliceUsage=(?&amp;lt;normalSliceUsage&amp;gt;\d+\.\d+%)\s+\*\s+totalWeightUsage=(?&amp;lt;totalWeightUsage&amp;gt;\d\.\d{2})\s+\*\s+userCount=(?&amp;lt;userCount&amp;gt;\d+)\s+\*\s+clinicalUserCount=(?&amp;lt;clinicalUserCount&amp;gt;\d+)\s+\*\s+AvgCPUUsage=(?&amp;lt;AvgCPUUsage&amp;gt;\d+\.\d+%)\s+\*\s+AvailableMemory=(?&amp;lt;AvailableMemory&amp;gt;\d+MB)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can checkout the how the rex working in the below site,&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;in the test string give the below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;*** Environment changed due to [Average CPU ] : normalSliceUsage=0.00% * totalWeightUsage=0.00 * userCount=0 * clinicalUserCount=0 * AvgCPUUsage=9.97% * AvailableMemory=6458MB ***
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the regex give the below regex,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; normalSliceUsage=(?&amp;lt;normalSliceUsage&amp;gt;\d+\.\d+%)\s+\*\s+totalWeightUsage=(?&amp;lt;totalWeightUsage&amp;gt;\d\.\d{2})\s+\*\s+userCount=(?&amp;lt;userCount&amp;gt;\d+)\s+\*\s+clinicalUserCount=(?&amp;lt;clinicalUserCount&amp;gt;\d+)\s+\*\s+AvgCPUUsage=(?&amp;lt;AvgCPUUsage&amp;gt;\d+\.\d+%)\s+\*\s+AvailableMemory=(?&amp;lt;AvailableMemory&amp;gt;\d+MB)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 08:58:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-you-help-me-get-multiple-fields-from-a-single-field-in-JSON/m-p/431658#M75530</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2018-12-10T08:58:52Z</dc:date>
    </item>
  </channel>
</rss>

