<?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: Extract unique Json String field value in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591044#M103537</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244322"&gt;@srinim1234&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try below search?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| rex field=message \"name\":\"(?&amp;lt;name&amp;gt;\w+)\" max_match=0
| mvexpand name
| table name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suggest above search for your requirement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below search for learning purpose as another way of achieving same output.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| rex field=message "request - (?&amp;lt;data&amp;gt;.*)" | rename data as _raw | kv
|mvexpand metrics{}.name
| table metrics{}.name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2022 08:22:27 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2022-03-28T08:22:27Z</dc:date>
    <item>
      <title>How to extract unique Json String field value?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591040#M103535</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have the following JSON String logs. I would like to extract JSON unique field values. It should go over all the message fields and extract specific field values from a JSON array("name") and unique them. Could someone help with Splunk query?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Raw log&lt;/P&gt;
&lt;PRE&gt;{&lt;BR /&gt;"@timestamp": "2022-03-28T07:38:45.123+00:00",&lt;BR /&gt;"message": "request - {\"metrics\":[{\"name\":\"m1\",\"downsample\":\"sum\"},{\"name\":\"m2\",\"downsample\":\"sum\"},{\"name\":\"m1\",\"downsample\":\"sum\"}]}"&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;JSON&lt;/P&gt;
&lt;PRE&gt; {&lt;BR /&gt;"metrics": [{&lt;BR /&gt;"name": "m1",&lt;BR /&gt;"aggregator": "sum",&lt;BR /&gt;}, {&lt;BR /&gt;"name": "m2",&lt;BR /&gt;"downsample": "sum"&lt;BR /&gt;}, {&lt;BR /&gt;"name": "m1",&lt;BR /&gt;"downsample": "sum"&lt;BR /&gt;}]&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected Output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;m1&lt;BR /&gt;m2&amp;nbsp;&lt;BR /&gt;...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 16:18:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591040#M103535</guid>
      <dc:creator>srinim1234</dc:creator>
      <dc:date>2022-03-28T16:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extract unique Json String field value</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591043#M103536</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "\\\\\"name\\\\\":\\\\\"(?&amp;lt;name&amp;gt;[^\\\\]+)"
| eval name=mvdedup(name)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Mar 2022 08:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591043#M103536</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-03-28T08:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extract unique Json String field value</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591044#M103537</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244322"&gt;@srinim1234&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try below search?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| rex field=message \"name\":\"(?&amp;lt;name&amp;gt;\w+)\" max_match=0
| mvexpand name
| table name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suggest above search for your requirement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below search for learning purpose as another way of achieving same output.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| rex field=message "request - (?&amp;lt;data&amp;gt;.*)" | rename data as _raw | kv
|mvexpand metrics{}.name
| table metrics{}.name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 08:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591044#M103537</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2022-03-28T08:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Extract unique Json String field value</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591048#M103538</link>
      <description>&lt;P&gt;Thank you! This helped!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 08:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-unique-Json-String-field-value/m-p/591048#M103538</guid>
      <dc:creator>srinim1234</dc:creator>
      <dc:date>2022-03-28T08:56:06Z</dc:date>
    </item>
  </channel>
</rss>

