<?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: How to extract a field from raw json? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/612008#M212795</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;&amp;nbsp;Rather than stats by count, i had to fix regular expression to take a escape character. It helped me fix. Thanks for responding and helping with great insights.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 01:17:37 GMT</pubDate>
    <dc:creator>asveturi</dc:creator>
    <dc:date>2022-09-06T01:17:37Z</dc:date>
    <item>
      <title>How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611500#M212606</link>
      <description>&lt;P class=""&gt;Hi Team,&lt;/P&gt;
&lt;P class=""&gt;From the below raw JSON string in Splunk, I am trying to display only correlationId column in a table, can someone help with a query on how to achieve this?&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;Also wanted to know if it can be achieved from a regular expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index= test1, sourcetype=abc



{

  "eventName": “test”,

  "sourceType”: “ats”,

  "detail": {

    "field": “abctest-1”,

    "trackInformation”: {

      "correlationId": “12345”,

      "components": [

        {

          "publisherTimeLog”: "2022-08-31T13:19:18.726",

          “MetaData”: “cmd”,

          "executionTimeInMscs”: “2”5,

          "receiverTimeLog”: "2022-08-31T13:19:18.725"

        }

      ]

    },

    "value": “imdb”,

    "timestamp": 1455677

  },

}





Output:

______



correlationID

———————

12345&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 19:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611500#M212606</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-08-31T19:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611502#M212607</link>
      <description>&lt;P&gt;Yes, it can be extracted using a regular expression.&amp;nbsp; Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=abc
| rex "\\\"correlationId\\\": \\\“(?&amp;lt;correlationId&amp;gt;[^\\\"]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Three backslashes are needed because there are multiple layers of parsing until the regex is evaluated.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 21:02:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611502#M212607</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-08-31T21:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611508#M212609</link>
      <description>&lt;P&gt;index=test1 sourcetype=abc | rex field=_raw "\\\"correlationId\\\": \\\“(?[^\\\"]+)" | search "*" correlationId | stats count by correlationId&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is able to pull up the correlation ids now, but still not able to display in table. refered few links but could not find any luck. Any pointers?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 20:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611508#M212609</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-08-31T20:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611509#M212610</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=abc
| rex "\\\"correlationId\\\": \\\“(?&amp;lt;correlationId&amp;gt;[^\\\"]+)"
| stats count by correlationId&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249021"&gt;@asveturi&lt;/a&gt; ...pls update us what happen when you run this above one..&lt;/P&gt;&lt;P&gt;may i know why you were using&amp;nbsp; this - "search "*" correlationId" please.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;happy splunking&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 20:44:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611509#M212610</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2022-08-31T20:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611510#M212611</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=abc
| table detail.trackInformation.correlationId&lt;/LI-CODE&gt;&lt;P&gt;Obviously, you can rename that field if you want to.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 20:47:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611510#M212611</guid>
      <dc:creator>ww9rivers</dc:creator>
      <dc:date>2022-08-31T20:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611517#M212613</link>
      <description>&lt;P class="lia-align-left"&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;1. When i run the above, the table which i am expecting under statistics is not returning any results or the list of IDs displayed.&lt;/P&gt;&lt;P class="lia-align-left"&gt;2. The reason i was using search "*" was in real time, i will be getting the value from a text box and will be passed as '$CORRELATION_ID'. To do testing from the search i am replace it with * to list all corrl ids.&lt;/P&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 21:29:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611517#M212613</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-08-31T21:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611518#M212614</link>
      <description>&lt;P&gt;tried this one too, but some how i am getting all null rows under statistics tab and not able to display any corrl ids in table.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 21:30:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611518#M212614</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-08-31T21:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611521#M212615</link>
      <description>&lt;P&gt;well, lets go step by step.&lt;/P&gt;&lt;P&gt;1. i see you are trying to create a table output, inside a dashboard.. is that right&lt;/P&gt;&lt;P&gt;2. the SPL query with rex and stats.. pls run this on Splunk Search Bar and try if it creates the table u r looking for. if it gives, then, dashboard troubleshooting will be easy.&lt;/P&gt;&lt;P&gt;3. u r looking for search time or index time extraction pls..&amp;nbsp; (for a big environment, this makes lot of difference. for a small project, you can ignore this search time vs index time)&lt;/P&gt;&lt;P&gt;4. some more info like.. splunk version, any special apps, dashboard viz app or basic dashboards.. would be helpful, thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 21:42:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/611521#M212615</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2022-08-31T21:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/612007#M212794</link>
      <description>&lt;P&gt;One extra '\' helped since it was looking for escape characters. Helped a lot! Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 01:15:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/612007#M212794</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-09-06T01:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from raw json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/612008#M212795</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;&amp;nbsp;Rather than stats by count, i had to fix regular expression to take a escape character. It helped me fix. Thanks for responding and helping with great insights.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 01:17:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-raw-json/m-p/612008#M212795</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-09-06T01:17:37Z</dc:date>
    </item>
  </channel>
</rss>

