<?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 lump data into two groups by a field for a trendline? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415914#M119727</link>
    <description>&lt;P&gt;try this search anywhere:&lt;/P&gt;

&lt;P&gt;i used numeric values for &lt;CODE&gt;measurement&lt;/CODE&gt; field and grouped with &lt;CODE&gt;eval&lt;/CODE&gt; by names &lt;BR /&gt;
your &lt;CODE&gt;timechart(values)&lt;/CODE&gt; might create multi value fields, which i think will not work very well withj &lt;CODE&gt;streamstats&lt;/CODE&gt;&lt;BR /&gt;
hope this sets you in the right direction&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start="05/16/201700:00:00" end="05/17/2018:00:00:00" increment=10m 
| eval _time = starttime 
| eval data = "name1;55,66,77,88|name2;55,66,77,88|name3;54,46,67,89|name4;53,36,73,38|name5;25,62,27,28|name6;51,16,71,18|name7;50,60,70,80"
| makemv delim="|" data
| mvexpand data
| rex field=data "(?&amp;lt;name&amp;gt;\w+)\;(?&amp;lt;measurement&amp;gt;\S+)"
| makemv delim="," measurement
| mvexpand measurement
| fields _time name measurement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the above generates fake data below is solution&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval groups = if(name=="name1" OR name=="name2","group1","group2")
| timechart span=12h values(measurement) as Measurement by groups
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2018 13:53:27 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2018-05-23T13:53:27Z</dc:date>
    <item>
      <title>How to lump data into two groups by a field for a trendline?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415911#M119724</link>
      <description>&lt;P&gt;So I have some data which looks similar to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;time="timevalue", name="name", measurement="value"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I have 7 different values for name (i.e., name1, name2, etc.)&lt;BR /&gt;
How can I group the data together so that, on the same trendline (graphing averages), it has the groups&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{name1, name2}
{name3, name4, name5, name6, name7}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And performs my calculations on those.&lt;BR /&gt;
The search right now returns an average of all events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search
| timechart span=12h values(measurement) as Measurement
| streamstats window=180 AVG
| table _time AVG*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 May 2018 12:56:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415911#M119724</guid>
      <dc:creator>splunk_question</dc:creator>
      <dc:date>2018-05-23T12:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to lump data into two groups by a field for a trendline?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415912#M119725</link>
      <description>&lt;P&gt;do you mean this:&lt;BR /&gt;
    base search&lt;BR /&gt;
     | timechart span=12h values(measurement) as Measurement by name&lt;BR /&gt;
     | streamstats window=180 AVG&lt;BR /&gt;
     | table _time AVG*&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 13:08:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415912#M119725</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-05-23T13:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to lump data into two groups by a field for a trendline?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415913#M119726</link>
      <description>&lt;P&gt;Yes, but instead of taking the averages by each individual name, I'd like to take the averages of (name1, name2) and (names 3-7) separately, while displaying them on the same chart.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 13:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415913#M119726</guid>
      <dc:creator>splunk_question</dc:creator>
      <dc:date>2018-05-23T13:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to lump data into two groups by a field for a trendline?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415914#M119727</link>
      <description>&lt;P&gt;try this search anywhere:&lt;/P&gt;

&lt;P&gt;i used numeric values for &lt;CODE&gt;measurement&lt;/CODE&gt; field and grouped with &lt;CODE&gt;eval&lt;/CODE&gt; by names &lt;BR /&gt;
your &lt;CODE&gt;timechart(values)&lt;/CODE&gt; might create multi value fields, which i think will not work very well withj &lt;CODE&gt;streamstats&lt;/CODE&gt;&lt;BR /&gt;
hope this sets you in the right direction&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start="05/16/201700:00:00" end="05/17/2018:00:00:00" increment=10m 
| eval _time = starttime 
| eval data = "name1;55,66,77,88|name2;55,66,77,88|name3;54,46,67,89|name4;53,36,73,38|name5;25,62,27,28|name6;51,16,71,18|name7;50,60,70,80"
| makemv delim="|" data
| mvexpand data
| rex field=data "(?&amp;lt;name&amp;gt;\w+)\;(?&amp;lt;measurement&amp;gt;\S+)"
| makemv delim="," measurement
| mvexpand measurement
| fields _time name measurement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the above generates fake data below is solution&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval groups = if(name=="name1" OR name=="name2","group1","group2")
| timechart span=12h values(measurement) as Measurement by groups
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 13:53:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415914#M119727</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-05-23T13:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to lump data into two groups by a field for a trendline?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415915#M119728</link>
      <description>&lt;P&gt;Perfect. I've been working on it and did much the same thing. I'm rather new to Splunk and didn't know how Boolean operations were parsed, and I was trying to ram through&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if(name=a OR b, " ", " ")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;rather than&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if(name=a OR name=b, ...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since the names are numeric, I was able to do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if(name&amp;lt;=name, ...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But thanks for letting me know about that!&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 14:09:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415915#M119728</guid>
      <dc:creator>splunk_question</dc:creator>
      <dc:date>2018-05-23T14:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to lump data into two groups by a field for a trendline?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415916#M119729</link>
      <description>&lt;P&gt;you bet! glad it helped &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 14:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-lump-data-into-two-groups-by-a-field-for-a-trendline/m-p/415916#M119729</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-05-23T14:17:45Z</dc:date>
    </item>
  </channel>
</rss>

