<?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 How to best combine 2 eval searches and use timechart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238964#M71009</link>
    <description>&lt;P&gt;I know this is fairly simple question. I am trying to do a couple evals on userAgent fields, as I am trying not to use the app for it. I am also trying to avoid extra actions so I was just using search and evals to accomplish this. the problem is that I cannot get it to work with timechart as I am trying to timechart by 2 fields.&lt;/P&gt;

&lt;P&gt;My basic evals are using if and match:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval browser_type = if(match(userAgent,"Firefox"),"Firefox", if(match(userAgent, "Safari"),"Safari", if(match(userAgent, "Macintosh"),"MAC", "OTHER"))) 
eval os_vendor = if(match(userAgent,"Windows"),"Windows", if(match(userAgent, "X11"),"Linux", if(match(userAgent, "Macintosh"),"MAC", "OTHER")))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then timechart them&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timechart count span=1d BY browser_type os_vendor
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a better way to combine the 2 evals to be able to achieve this with timechart?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 07 Oct 2016 14:53:55 GMT</pubDate>
    <dc:creator>tkwaller</dc:creator>
    <dc:date>2016-10-07T14:53:55Z</dc:date>
    <item>
      <title>How to best combine 2 eval searches and use timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238964#M71009</link>
      <description>&lt;P&gt;I know this is fairly simple question. I am trying to do a couple evals on userAgent fields, as I am trying not to use the app for it. I am also trying to avoid extra actions so I was just using search and evals to accomplish this. the problem is that I cannot get it to work with timechart as I am trying to timechart by 2 fields.&lt;/P&gt;

&lt;P&gt;My basic evals are using if and match:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval browser_type = if(match(userAgent,"Firefox"),"Firefox", if(match(userAgent, "Safari"),"Safari", if(match(userAgent, "Macintosh"),"MAC", "OTHER"))) 
eval os_vendor = if(match(userAgent,"Windows"),"Windows", if(match(userAgent, "X11"),"Linux", if(match(userAgent, "Macintosh"),"MAC", "OTHER")))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then timechart them&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timechart count span=1d BY browser_type os_vendor
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a better way to combine the 2 evals to be able to achieve this with timechart?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 14:53:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238964#M71009</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-10-07T14:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to best combine 2 eval searches and use timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238965#M71010</link>
      <description>&lt;P&gt;Hi tkwaller&lt;BR /&gt;
If you share an example of your log, maybe it's possible to extract fields using regexes at search time.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 14:59:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238965#M71010</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-10-07T14:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to best combine 2 eval searches and use timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238966#M71011</link>
      <description>&lt;P&gt;Try with &lt;CODE&gt;case&lt;/CODE&gt; instead of &lt;CODE&gt;if&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval browser_type = case(match(userAgent,"Firefox"),"Firefox", match(userAgent, "Safari","Safari", match(userAgent, "Macintosh"),"MAC", 1=1, "OTHER") | eval os_vendor = case(match(userAgent,"Windows"),"Windows", match(userAgent, "X11"),"Linux", match(userAgent, "Macintosh"),"MAC", 1=1, "OTHER") | timechart span=1d count by browser_type os_vendor
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Oct 2016 15:01:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238966#M71011</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-07T15:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to best combine 2 eval searches and use timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238967#M71012</link>
      <description>&lt;P&gt;Try like this (combining browser_type and os_vendor as one field as timechart doesn't support two fields in by clause&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... | eval groupbyfield= case(match(userAgent,"Firefox"),"Firefox", match(userAgent, "Safari","Safari", match(userAgent, "Macintosh"),"MAC", 1=1, "OTHER") | eval groupbyfield= groupbyfield.":".case(match(userAgent,"Windows"),"Windows", match(userAgent, "X11"),"Linux", match(userAgent, "Macintosh"),"MAC", 1=1, "OTHER") | timechart span=1d count by groupbyfield
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:19:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238967#M71012</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T11:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to best combine 2 eval searches and use timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238968#M71013</link>
      <description>&lt;P&gt;Keep in mind that a timechart accept only one clause by.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timechart count span=1d BY browser_type os_vendor
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;having both "browser_type" and "os_vendor" is too much.&lt;/P&gt;

&lt;P&gt;You can prefer to create a merged field with to keep displaying, and raise the limit of numbers of series to display (default is 10)&lt;BR /&gt;
example : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval browser_os=browser_type."-".os_vendor limit=20
 |     timechart count span=1d BY browser_os
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238968#M71013</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2020-09-29T11:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to best combine 2 eval searches and use timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238969#M71014</link>
      <description>&lt;P&gt;Yes this worked, case definitely worked here, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 14:31:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-combine-2-eval-searches-and-use-timechart/m-p/238969#M71014</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-10-17T14:31:09Z</dc:date>
    </item>
  </channel>
</rss>

