<?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: Compare two search results' differences over time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247825#M189165</link>
    <description>&lt;P&gt;Sorry mhpark - was out of office for a few days. &lt;/P&gt;

&lt;P&gt;1 event = 1 play. &lt;/P&gt;

&lt;P&gt;Shared artist play = the total number of plays/events across with identical ARTIST values across diferent STATION ids. &lt;/P&gt;

&lt;P&gt;"Is a play with two artists, a single play, or two plays?"&lt;BR /&gt;
1 event = 1 play always even when multiple values in ARTIST. &lt;/P&gt;

&lt;P&gt;Yes would be great to base it off the query above.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 14:19:45 GMT</pubDate>
    <dc:creator>thdose</dc:creator>
    <dc:date>2016-09-13T14:19:45Z</dc:date>
    <item>
      <title>Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247820#M189160</link>
      <description>&lt;P&gt;First timer here - hi all and thanks for this amazing ressource. &lt;/P&gt;

&lt;P&gt;I am trying to timechart the counts for unique and shared values of 2 different lists. &lt;/P&gt;

&lt;P&gt;My events:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;"2016-08-08 10:46:09" PLAY_ID="112680324", PLAY_DATE="2015-12-01 09:00:03", ARTIST="Coldplay", TITLE="Hymn For The Weekend  feat. Beyonce",  STATION_ID="S1"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;"2016-08-08 10:46:06" PLAY_ID="110914851", PLAY_DATE="2015-12-01 21:24:48", ARTIST="DJ Snake;Major Lazer", TITLE="Lean On", STATION_ID="S2"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I need to show the number of artists that are only played on each of the stations and the shared artists that both stations play. And how these counts evolve over time. &lt;/P&gt;

&lt;P&gt;Inspired by this article: &lt;A href="https://know-how.io/?p=32"&gt;https://know-how.io/?p=32&lt;/A&gt; I have this search:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | PLAY_DATE="2015-12-01*" (STATION_ID="S1" OR STATION_ID="S2") | makemv delim=";" ARTIST | eval S1=if(CH_WO=="S1", ARTIST, NULL)| eval S2=if(CH_WO=="S2", KUN, NULL) | stats values(S1) as Station1, values(S2) as Station2 | mvexpand Station1 | mvexpand Station2 | where Station1==Station2 | rename Station1 as shared | table shared&lt;/CODE&gt;    &lt;/P&gt;

&lt;P&gt;The ARTIST field can hold multiple artists separated by ; &lt;/P&gt;

&lt;P&gt;The query works, but only gives me the actual shared artists within a specified time period. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;I'd like to include the unique artist counts for each station as well.&lt;/LI&gt;
&lt;LI&gt; I am specifying the time period  (PLAY_DATE="2015-12-01*") where I'd like to bin span time periods in order to do per week, month, year etc. &lt;/LI&gt;
&lt;LI&gt;The search is painstakenly slow. The example search takes about 10 secs.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Ideally I'd like to end up with a graph like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1768i019ECE6A3EA8BF24/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Any help would be much welcome. &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 07:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247820#M189160</guid>
      <dc:creator>thdose</dc:creator>
      <dc:date>2016-08-26T07:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247821#M189161</link>
      <description>&lt;P&gt;Give this a try. &lt;BR /&gt;
if the bin option doesn't work on PLAY_DATE,&lt;BR /&gt;
try to dump it to _time by &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time = PLAY_DATE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, put your filtering queries (STATION_ID) in front as far as you can, for performance.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;STATION_ID="S1" OR STATION_ID="S2"
| makemv delim=";" ARTIST
| mvexpand ARTIST
| bin PLAY_DATE span=12mon
| stats values(STATION_ID) as station by ARTIST, PLAY_DATE
| eval station = if (mvcount(station)==2, "shared", station)
| stats dc(ARTIST) as artist_count by station, PLAY_DATE
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 14:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247821#M189161</guid>
      <dc:creator>mhpark</dc:creator>
      <dc:date>2016-08-26T14:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247822#M189162</link>
      <description>&lt;P&gt;Perfect! I does exactly what we wanted. Thank you!!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 18:49:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247822#M189162</guid>
      <dc:creator>thdose</dc:creator>
      <dc:date>2016-08-26T18:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247823#M189163</link>
      <description>&lt;P&gt;If we wan't to do the same only with the total count all the plays, how would that work?&lt;/P&gt;

&lt;P&gt;The above solution gives us the unique artist count, but we would like to see the total number of plays (events) for each station and the total number of shared artist plays....&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 16:18:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247823#M189163</guid>
      <dc:creator>thdose</dc:creator>
      <dc:date>2016-09-08T16:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247824#M189164</link>
      <description>&lt;P&gt;Please share a result example of what you want.&lt;/P&gt;

&lt;P&gt;What is a "play"?&lt;BR /&gt;
does one play refer to one event?&lt;/P&gt;

&lt;P&gt;What is a "shared artist play"?&lt;BR /&gt;
a play (=event) with more than one artist?&lt;/P&gt;

&lt;P&gt;Is a play with two artists, a single play, or two plays?&lt;/P&gt;

&lt;P&gt;Do you want to see the result appended to the query above?&lt;/P&gt;

&lt;P&gt;More understanding of your requirements would help.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 13:26:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247824#M189164</guid>
      <dc:creator>mhpark</dc:creator>
      <dc:date>2016-09-09T13:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247825#M189165</link>
      <description>&lt;P&gt;Sorry mhpark - was out of office for a few days. &lt;/P&gt;

&lt;P&gt;1 event = 1 play. &lt;/P&gt;

&lt;P&gt;Shared artist play = the total number of plays/events across with identical ARTIST values across diferent STATION ids. &lt;/P&gt;

&lt;P&gt;"Is a play with two artists, a single play, or two plays?"&lt;BR /&gt;
1 event = 1 play always even when multiple values in ARTIST. &lt;/P&gt;

&lt;P&gt;Yes would be great to base it off the query above.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 14:19:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247825#M189165</guid>
      <dc:creator>thdose</dc:creator>
      <dc:date>2016-09-13T14:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two search results' differences over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247826#M189166</link>
      <description>&lt;P&gt;Assuming you need to split the events not only with ARTIST, but also PLAY_DATE,&lt;/P&gt;

&lt;P&gt;You should do the latter first since you split the ARTIST field with mvexpand.&lt;BR /&gt;
you just need to take off the mvexpand part.&lt;/P&gt;

&lt;P&gt;it would be like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;STATION_ID="S1" OR STATION_ID="S2"
| stats values(STATION_ID) as station by ARTIST, PLAY_DATE
| eval station = if (mvcount(station)==2, "shared", station)
| bin PLAY_DATE span=1d
| stats dc(ARTIST) as play_count by station, PLAY_DATE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to merge them would be difficult, since mvexpand breaks a field.&lt;BR /&gt;
I don't have any great ideas, so I would just call appendcols or something for now.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(query1)
| appendcols [ (query2) ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;by the way, please verify this assumption.&lt;/P&gt;

&lt;P&gt;if one play had ARTIST  A;B at station1,&lt;BR /&gt;
and another had ARTIST B;C at station2.&lt;/P&gt;

&lt;P&gt;the two are not shared plays, but B is a shared artist. right?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 13:30:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-two-search-results-differences-over-time/m-p/247826#M189166</guid>
      <dc:creator>mhpark</dc:creator>
      <dc:date>2016-09-15T13:30:49Z</dc:date>
    </item>
  </channel>
</rss>

