<?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 compare two fields in json data and display data in the third field for the matched data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/compare-two-fields-in-json-data-and-display-data-in-the-third/m-p/543790#M154041</link>
    <description>&lt;P class="lia-align-left"&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have only started working on splunk recently and i am stuck at one query. So, I have JSON data like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;catDevices: [ {
model: A1_1234
Name: ZASNJHCDNA
}
 {

model: A1_5678
Name: JNDIHUEDHNJ
}]
Devices : [ 
JNDIHUEDHNJ
NVBBVUYVBHI
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to compare "Devices" with caDevices{}.Name and if it matches i want to display Devices and model list.&lt;/P&gt;&lt;P&gt;I tried this query&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype=device |rename Devices{} as success | mvexpand success |dedup success |rename catDevices{}. model as Model ,rename catDevices{}.Name as device_name |eval zip = mvzip(Model, device_name) |fields - _raw |mvexpand zip | rex field = zip "(?&amp;lt;MODEL&amp;gt;.*),(?&amp;lt;DEVICE&amp;gt;.*)" | fields - zip | eval Status = if(match(MODEL,"A1*"), if(success == DEVICE, success, "NO MATCH"), "NO MATCH") | table success, MODEL, Status | where Status != "NO MATCH" | stats count(success) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked but as the data increases , due to mvexpand threshold the result is not accurate. Can you please tell me how i can correct my query or if you can provide a different solution for my question, any help would be appreciated. thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Mar 2021 12:20:10 GMT</pubDate>
    <dc:creator>nikitha15</dc:creator>
    <dc:date>2021-03-17T12:20:10Z</dc:date>
    <item>
      <title>compare two fields in json data and display data in the third field for the matched data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-two-fields-in-json-data-and-display-data-in-the-third/m-p/543790#M154041</link>
      <description>&lt;P class="lia-align-left"&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have only started working on splunk recently and i am stuck at one query. So, I have JSON data like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;catDevices: [ {
model: A1_1234
Name: ZASNJHCDNA
}
 {

model: A1_5678
Name: JNDIHUEDHNJ
}]
Devices : [ 
JNDIHUEDHNJ
NVBBVUYVBHI
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to compare "Devices" with caDevices{}.Name and if it matches i want to display Devices and model list.&lt;/P&gt;&lt;P&gt;I tried this query&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype=device |rename Devices{} as success | mvexpand success |dedup success |rename catDevices{}. model as Model ,rename catDevices{}.Name as device_name |eval zip = mvzip(Model, device_name) |fields - _raw |mvexpand zip | rex field = zip "(?&amp;lt;MODEL&amp;gt;.*),(?&amp;lt;DEVICE&amp;gt;.*)" | fields - zip | eval Status = if(match(MODEL,"A1*"), if(success == DEVICE, success, "NO MATCH"), "NO MATCH") | table success, MODEL, Status | where Status != "NO MATCH" | stats count(success) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked but as the data increases , due to mvexpand threshold the result is not accurate. Can you please tell me how i can correct my query or if you can provide a different solution for my question, any help would be appreciated. thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 12:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-two-fields-in-json-data-and-display-data-in-the-third/m-p/543790#M154041</guid>
      <dc:creator>nikitha15</dc:creator>
      <dc:date>2021-03-17T12:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: compare two fields in json data and display data in the third field for the matched data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-two-fields-in-json-data-and-display-data-in-the-third/m-p/543851#M154056</link>
      <description>&lt;P&gt;There appear to be a couple of typos(?) in your query (order of fields in mvzip don't match rex extraction, table field name should be success not suc, device is not listed in table so count should possibly be MODEL), but aside from this, if the issue is to do with mvexpand limitations, have a look at this solution to see if it helps&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Enterprise/Alternatives-to-using-MVExpand-running-into-limitations/m-p/541523#M5051" target="_self"&gt;https://community.splunk.com/t5/Splunk-Enterprise/Alternatives-to-using-MVExpand-running-into-limitations/m-p/541523#M5051&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 12:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-two-fields-in-json-data-and-display-data-in-the-third/m-p/543851#M154056</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-03-15T12:33:28Z</dc:date>
    </item>
  </channel>
</rss>

