<?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 write a query that will separate browser sections in a JSON array into separate events? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243769#M47197</link>
    <description>&lt;P&gt;Still seems to be outputting the other browsers in the data.  This was the issue I was having, it seems like it doesn't want to separate out those non-Chrome browsers.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2016 19:18:26 GMT</pubDate>
    <dc:creator>jpringle03</dc:creator>
    <dc:date>2016-10-12T19:18:26Z</dc:date>
    <item>
      <title>How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243760#M47188</link>
      <description>&lt;P&gt;I'm currently trying to write a query that will let me separate the follow "browser" sections in this JSON array into separate events, preferably with the rest of the data in the output still being included. &lt;/P&gt;

&lt;P&gt;The problem I'm running into at the moment is when I try to write a query for returning only the count for different versions of Chrome, in a situation where there is another browser present in the record, I'm getting "browser_version" field of the other browser being included as well.&lt;/P&gt;

&lt;P&gt;An example of this query is: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=security browser_family "browsers{}.browser_family"=Chrome*| spath "browsers{}.browser_version" | chart count by browsers{}.browser_version | sort browsers{}.browser_version`


 {
            "browsers": [{
                "browser_family": "Chrome",
                "browser_version": "51.0.2704.103",
                "flash_version": "22.0.0.0",
                "java_version": "uninstalled"
            },
            {
                "browser_family": "Safari",
                "browser_version": "9.1.1",
                "flash_version": "uninstalled",
                "java_version": "1.8.0.45",
                "last_used": 1474483713
            }],
            "email": "ejennings@example.com",
            "epkey": "EP18JX1A10AB102M2T2X",
            "model": "",
            "os_family": "Mac OS X",
            "os_version": "10.11.5",
            "type": "",
            "username": "ejennings"
        }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas of how I could accomplish this?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:35:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243760#M47188</guid>
      <dc:creator>jpringle03</dc:creator>
      <dc:date>2016-10-12T14:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243761#M47189</link>
      <description>&lt;P&gt;See if this helps&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=security browser_family "browsers{}.browser_family"=Chrome*| spath "browsers{}.browser_version" | rename "browsers{}.*" AS * | eval z=mvzip(browser_family, mvzip(browser_version, mvzip(flash_version,  java_version))) | mvexpand z | rex field=z "(?&amp;lt;family&amp;gt;[^,]+),(?&amp;lt;version&amp;gt;[^,]+),(?&amp;lt;flash_version&amp;gt;[^,]+),(?&amp;lt;java_version&amp;gt;.*)" | fields family version flash_version java_version | where match(family, "Chrome") |  chart count values(*) as * by version | sort version
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 16:48:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243761#M47189</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-12T16:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243762#M47190</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=security browser_family "browsers{}.browser_family"=Chrome*
| spath "browsers{}.browser_version" 
| eval Browser_Version=mvzip('browsers{}.browser_family','browsers{}.browser_version',"#")
| stats count by Browser_Version | where match(Browser_Version,"Chrome") | replace "Chrome#*" with "*"  in Browser_Version
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Updated&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=security browser_family "browsers{}.browser_family"=Chrome*
| spath "browsers{}.browser_version" 
| eval Browser_Version=mvzip('browsers{}.browser_family','browsers{}.browser_version',"#")
| stats count by Browser_Version | where match(Browser_Version,".*Chrome.*") 
| eval Browser_Version=mvindex(split(Browser_Version,"#"),-1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 17:44:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243762#M47190</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-12T17:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243763#M47191</link>
      <description>&lt;P&gt;When trying this it it gave me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'eval' command: The expression is malformed. An unexpected character is reached at ', mvzip(flash_version, java_version))))'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I changed it a little and I think it might be doing what I want, but I need to look into it more. Here is what I have now: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=security browser_family "browsers{}.browser_family"=Chrome*| spath "browsers{}.browser_version" | rename "browsers{}.*" AS * | eval z=mvzip(browser_family, mvzip(browser_version, mvzip(flash_version,  java_version))) | mvexpand z | rex field=z "(?&amp;lt;family&amp;gt;[^,]+),(?&amp;lt;version&amp;gt;[^,]+),(?&amp;lt;flash_version&amp;gt;[^,]+),(?&amp;lt;java_version&amp;gt;.*)" | fields family version flash_version java_version | where match(family, "Chrome") |  chart count values(*) as * by version | sort version
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 18:00:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243763#M47191</guid>
      <dc:creator>jpringle03</dc:creator>
      <dc:date>2016-10-12T18:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243764#M47192</link>
      <description>&lt;P&gt;Thanks for the suggestion! &lt;/P&gt;

&lt;P&gt;I gave this a try but it still gave an output that contained over browsers:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/FxVHVUv.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 18:06:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243764#M47192</guid>
      <dc:creator>jpringle03</dc:creator>
      <dc:date>2016-10-12T18:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243765#M47193</link>
      <description>&lt;P&gt;Give the updated answer a try.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 18:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243765#M47193</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-12T18:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243766#M47194</link>
      <description>&lt;P&gt;You got it! Edited original post to fix typos. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 18:51:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243766#M47194</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-12T18:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243767#M47195</link>
      <description>&lt;P&gt;Hey somesoni2,&lt;/P&gt;

&lt;P&gt;Just tried and it stripped out the names from the browser_version field which is a win but is still showing the other browser versions (like Safari and AppleMail)&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/NmdIWuE.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 18:57:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243767#M47195</guid>
      <dc:creator>jpringle03</dc:creator>
      <dc:date>2016-10-12T18:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243768#M47196</link>
      <description>&lt;P&gt;Strange, the match was able to filter on my sample data. Give this a try then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=security browser_family "browsers{}.browser_family"=Chrome*
 | spath "browsers{}.browser_version" 
 | eval Browser_Version=mvzip('browsers{}.browser_family','browsers{}.browser_version',"#")
 | stats count by Browser_Version | where like(lower(Browser_Version),"%chrome%") 
 | eval Browser_Version=mvindex(split(Browser_Version,"#"),-1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 19:00:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243768#M47196</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-12T19:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query that will separate browser sections in a JSON array into separate events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243769#M47197</link>
      <description>&lt;P&gt;Still seems to be outputting the other browsers in the data.  This was the issue I was having, it seems like it doesn't want to separate out those non-Chrome browsers.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 19:18:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-write-a-query-that-will-separate-browser-sections-in-a/m-p/243769#M47197</guid>
      <dc:creator>jpringle03</dc:creator>
      <dc:date>2016-10-12T19:18:26Z</dc:date>
    </item>
  </channel>
</rss>

