<?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 search JSON data in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457351#M79031</link>
    <description>&lt;P&gt;I tried to create a span path to the correct Key (X-Real-IP) but it didn't work, my experience with json paths is not great&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2019 10:27:44 GMT</pubDate>
    <dc:creator>vbotnari1</dc:creator>
    <dc:date>2019-07-08T10:27:44Z</dc:date>
    <item>
      <title>How to search JSON data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457349#M79029</link>
      <description>&lt;P&gt;I am trying to parse this json using spath&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {  
       "Request":{  
          "Uri":"/api/...",
          "requestHeaders":[  

             {  
                "Key":"X-Real-IP",
                "Value":[  
                   "213.205.240.26, 55.145.164.26"
                ]
             },
             {  
                "Key":"X-Forwarded-For",
                "Value":[  
                   "111.111.240.26"
                ]
             },

          "ContentHeaders":[  
             {  
                "Key":"Content-Length",
                "Value":[  
                   "0"
                ]
             }
          ],
          "Body":null
       },
       "Response":{  },
       "TimeTakenMs":119
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to extract the first value for X-Real-IP. Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 09:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457349#M79029</guid>
      <dc:creator>vbotnari1</dc:creator>
      <dc:date>2019-07-08T09:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to search JSON data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457350#M79030</link>
      <description>&lt;P&gt;What do you have so far and what exactly do you need help with?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 09:51:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457350#M79030</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-08T09:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to search JSON data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457351#M79031</link>
      <description>&lt;P&gt;I tried to create a span path to the correct Key (X-Real-IP) but it didn't work, my experience with json paths is not great&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 10:27:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457351#M79031</guid>
      <dc:creator>vbotnari1</dc:creator>
      <dc:date>2019-07-08T10:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to search JSON data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457352#M79032</link>
      <description>&lt;P&gt;Looking at your data again: the difficulty is that X-Real-IP is not an actual json key that you can target with spath. It is the value of a field called Key.&lt;/P&gt;

&lt;P&gt;You can extract this, but not with just using spath.&lt;/P&gt;

&lt;P&gt;In this particular case a simple regex might be easier:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| rex "\"Key\":\"X-Real-IP\",\s*\"Value\":\[\s*\"(?&amp;lt;X_Real_IP&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/ZObcvZ/1"&gt;https://regex101.com/r/ZObcvZ/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 11:30:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-search-JSON-data/m-p/457352#M79032</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-08T11:30:44Z</dc:date>
    </item>
  </channel>
</rss>

