<?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 do I find events that have a specific value in an array of JSON strings? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-events-that-have-a-specific-value-in-an-array-of/m-p/409084#M118027</link>
    <description>&lt;P&gt;Hi @cpomerantzunison,&lt;/P&gt;

&lt;P&gt;Please try below query (Here I am assuming that JSON data is already parsed and you have field called &lt;CODE&gt;tags{}&lt;/CODE&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="logs" 
| rename tags{} AS tagvalue
| where (tagvalue LIKE "value2")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Below is run anywhere search which you can run on any splunk instance and check the output.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval field1="{
  \"tags\": [
    \"value1\",
    \"value2\"
  ]
}"
| append [ makeresults
| eval field1="{
  \"tags\": [
    \"value1\",
    \"value3\"
  ]
}" ]
| spath input=field1
| rename tags{} AS test_tag
| where (test_tag LIKE "value2")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 05 Oct 2018 11:51:49 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2018-10-05T11:51:49Z</dc:date>
    <item>
      <title>How do I find events that have a specific value in an array of JSON strings?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-events-that-have-a-specific-value-in-an-array-of/m-p/409083#M118026</link>
      <description>&lt;P&gt;I have a JSON object that includes a field that is an array of strings. So something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  "tags": [
    "value1",
    "value2"
  ]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to find all of the events that contain a specific value like "value2". I tried using mvfind but that didn't seem to work, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="logs" | where isnotnull(mvfind(tags, "value2"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can someone tell me how I can do this?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 21:22:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-events-that-have-a-specific-value-in-an-array-of/m-p/409083#M118026</guid>
      <dc:creator>cpomerantzuniso</dc:creator>
      <dc:date>2018-10-04T21:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I find events that have a specific value in an array of JSON strings?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-events-that-have-a-specific-value-in-an-array-of/m-p/409084#M118027</link>
      <description>&lt;P&gt;Hi @cpomerantzunison,&lt;/P&gt;

&lt;P&gt;Please try below query (Here I am assuming that JSON data is already parsed and you have field called &lt;CODE&gt;tags{}&lt;/CODE&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="logs" 
| rename tags{} AS tagvalue
| where (tagvalue LIKE "value2")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Below is run anywhere search which you can run on any splunk instance and check the output.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval field1="{
  \"tags\": [
    \"value1\",
    \"value2\"
  ]
}"
| append [ makeresults
| eval field1="{
  \"tags\": [
    \"value1\",
    \"value3\"
  ]
}" ]
| spath input=field1
| rename tags{} AS test_tag
| where (test_tag LIKE "value2")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Oct 2018 11:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-find-events-that-have-a-specific-value-in-an-array-of/m-p/409084#M118027</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-05T11:51:49Z</dc:date>
    </item>
  </channel>
</rss>

