<?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: json output read single value when there are multiple for a segment in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466723#M80408</link>
    <description>&lt;P&gt;And by &lt;CODE&gt;show&lt;/CODE&gt; I DO NOT mean a picture; send us plain text.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2019 01:09:42 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-10-29T01:09:42Z</dc:date>
    <item>
      <title>json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466720#M80405</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have a json output which is getting indexed correctly. &lt;BR /&gt;
And i am collectng ip from remotemanagement{}.ip . But for some cases i have multiple ips under remotemanagement. In those cases i need to select only that one ip where protocol.name is NOT console. If there are 3 ips and for one the protocol.name is &lt;STRONG&gt;console&lt;/STRONG&gt; then leave it and out of the rest 2 take any one ip. &lt;BR /&gt;
As you can see from the screen shot one has &lt;STRONG&gt;protocol.name&lt;/STRONG&gt; = &lt;STRONG&gt;console&lt;/STRONG&gt; and for the third one &lt;STRONG&gt;protocol.name = ssh&lt;/STRONG&gt;&lt;BR /&gt;
So here will need to eval &lt;STRONG&gt;ssh_ip=192.0.32.38&lt;/STRONG&gt;    &lt;/P&gt;

&lt;P&gt;And then use it in my below query to filter only those records. &lt;/P&gt;

&lt;P&gt;index="unicorn" ( "infrastructure{}.type"=critical OR  "infrastructure{}.type"=vital ) |mvexpand infrastructure{}.name  |rename assetId as "AssetID"  infrastructure{}.name as "Infrastrucure Name"  name  as Nom   remoteManagement{}.ip as Ip realm{}.name as Type | table "Infrastrucure Name" "AssetID"  Nom  Ip  Type |mvexpand Ip | where Ip=ssh_ip&lt;/P&gt;

&lt;P&gt;how to calculate ssh_ip here ? as i tried to use &lt;BR /&gt;
| spath "remoteManagement{}.protocol.name" | search "remoteManagement{}.protocol.name"!=console&lt;BR /&gt;
OR&lt;BR /&gt;
| spath "remoteManagement{}.protocol.name" | search "remoteManagement{}.protocol.name"=ssh&lt;/P&gt;

&lt;P&gt;But its giving all the 3 ips. &lt;/P&gt;

&lt;P&gt;Please help. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 10:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466720#M80405</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2019-10-28T10:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466721#M80406</link>
      <description>&lt;P&gt;I don't see a screenshot - can you give a sanitized version of the result up to where you're happy with the output to that point? (i.e. what is the result before you're trying your &lt;CODE&gt;spath&lt;/CODE&gt; command)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 18:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466721#M80406</guid>
      <dc:creator>aberkow</dc:creator>
      <dc:date>2019-10-28T18:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466722#M80407</link>
      <description>&lt;P&gt;Show us entire sample events and a mockup of the desired output.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 23:30:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466722#M80407</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-28T23:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466723#M80408</link>
      <description>&lt;P&gt;And by &lt;CODE&gt;show&lt;/CODE&gt; I DO NOT mean a picture; send us plain text.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 01:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466723#M80408</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-29T01:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466724#M80409</link>
      <description>&lt;P&gt;hi @aberkow and @woodcock ,&lt;/P&gt;

&lt;P&gt;I am so sorry for the inconvenience, hope you can see the images now. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 05:31:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466724#M80409</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2019-10-29T05:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466725#M80410</link>
      <description>&lt;P&gt;Hi @woodcock and @aberkow,&lt;/P&gt;

&lt;P&gt;Could you please help me here. As i have uploaded the images now. &lt;/P&gt;

&lt;P&gt;Thanks in advance. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 11:43:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466725#M80410</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2019-10-30T11:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466726#M80411</link>
      <description>&lt;P&gt;Did you notice where I said NOT to use images? Post TEXT.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466726#M80411</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-30T13:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466727#M80412</link>
      <description>&lt;P&gt;Hi @woodcock,&lt;/P&gt;

&lt;P&gt;Below is what i am receiving under remoteManagement which i am evaluating for Ip. &lt;BR /&gt;
Now my requirement is i need to get only the ip where protocol.name=ssh&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; remoteManagement:  [   [-] 
    {   [-] 
     additionalInformation:  null   
     device:     7490   
     id:     18450  
     ip:     184.7.138.72   
     login:  HASDf  
     password:   null   
     plainTextURL:   null   
     port:   7013   
     protocol:  {   [-] 
         name:   console    
    }   
    }   
    {   [-] 
     additionalInformation:  null   
     device:     7490   
     id:     18451  
     ip:     192.0.32.38    
     login:  matricule SG   
     password:   null   
     plainTextURL:   null   
     port:   443    
     protocol:  {   [-] 
         name:   https  
    }   
    }   
    {   [-] 
     additionalInformation:  null   
     device:     7490   
     id:     18449  
     ip:     192.0.32.38    
     login:  matricule SG   
     password:   null   
     plainTextURL:   null   
     port:   22 
     protocol:  {   [-] 
         name:   ssh    
    }   
    }   
]   
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2019 08:47:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466727#M80412</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2019-10-31T08:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466728#M80413</link>
      <description>&lt;P&gt;Hello @surekhasplunk&lt;/P&gt;

&lt;P&gt;Kindly post &lt;CODE&gt;_raw&lt;/CODE&gt; event.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 08:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466728#M80413</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-10-31T08:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466729#M80414</link>
      <description>&lt;P&gt;For example:&lt;BR /&gt;
Below is my query and i know for this asset id i have 3 values under remoteManagement{}.ip&lt;/P&gt;

&lt;P&gt;index="unicorn"| spath assetId | search assetId=MA9624121 |lookup Input_splunk_all.csv RTR as name  |spath output=manage remoteManagement{} | table name manage&lt;/P&gt;

&lt;P&gt;Below is the output. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name    manage
HFSOFW401   
{"id":18450,"protocol":{"name":"console"},"ip":"184.7.138.72","port":"7013","additionalInformation":null,"plainTextURL":null,"login":"HFSOFW401","password":null,"device":7490}
{"id":18451,"protocol":{"name":"https"},"ip":"192.0.32.38","port":"443","additionalInformation":null,"plainTextURL":null,"login":"matricule SG","password":null,"device":7490}
{"id":18449,"protocol":{"name":"ssh"},"ip":"192.0.32.38","port":"22","additionalInformation":null,"plainTextURL":null,"login":"matricule SG","password":null,"device":7490}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:48:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466729#M80414</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-09-30T02:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466730#M80415</link>
      <description>&lt;P&gt;I think that I finally get it.  Try adding this to drop the &lt;CODE&gt;console&lt;/CODE&gt; values from the &lt;CODE&gt;multivalued&lt;/CODE&gt; &lt;CODE&gt;manage&lt;/CODE&gt; field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval manage = mvfilter(NOT match(manage, "\"name\":\"console\""))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Nov 2019 21:41:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466730#M80415</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-09T21:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: json output read single value when there are multiple for a segment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466731#M80416</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index="unicorn"
| spath assetId 
| search assetId=MA9624121 
| lookup Input_splunk_all.csv RTR as name 
| spath output=manage remoteManagement{} 
| table name manage
| stats values(name) as name by manage
| spath input=manage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @surekhasplunk&lt;BR /&gt;
How about this?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jan 2020 00:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/json-output-read-single-value-when-there-are-multiple-for-a/m-p/466731#M80416</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-11T00:48:43Z</dc:date>
    </item>
  </channel>
</rss>

