<?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 use eval for basic search terms (NOT fields)? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396196#M115026</link>
    <description>&lt;P&gt;So I want to get the stats count of two search terms in a search that looks like this:&lt;BR /&gt;
&lt;CODE&gt;index=myIndex "searchTermA" OR "searchTermB"&lt;/CODE&gt;  (these searches being strings to find certain applications under the index and they have no fields to search for them by nor are they similar enough for field extraction to work [individually field extracting these also proves to have a lot of issues as well]).&lt;/P&gt;

&lt;P&gt;and what I wish I could do is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex "searchTermA" OR "searchTermB"  | stats (or chart/timechart) count("searchTermA") count("searchTermB")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to get the data I want.&lt;/P&gt;

&lt;P&gt;However, I am aware this is not possible. Is there some way to use eval to give these search strings a name and use them for count?&lt;/P&gt;

&lt;P&gt;I also cannot go into the .conf files and edit them.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jun 2018 12:44:05 GMT</pubDate>
    <dc:creator>link22</dc:creator>
    <dc:date>2018-06-19T12:44:05Z</dc:date>
    <item>
      <title>How to use eval for basic search terms (NOT fields)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396196#M115026</link>
      <description>&lt;P&gt;So I want to get the stats count of two search terms in a search that looks like this:&lt;BR /&gt;
&lt;CODE&gt;index=myIndex "searchTermA" OR "searchTermB"&lt;/CODE&gt;  (these searches being strings to find certain applications under the index and they have no fields to search for them by nor are they similar enough for field extraction to work [individually field extracting these also proves to have a lot of issues as well]).&lt;/P&gt;

&lt;P&gt;and what I wish I could do is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex "searchTermA" OR "searchTermB"  | stats (or chart/timechart) count("searchTermA") count("searchTermB")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to get the data I want.&lt;/P&gt;

&lt;P&gt;However, I am aware this is not possible. Is there some way to use eval to give these search strings a name and use them for count?&lt;/P&gt;

&lt;P&gt;I also cannot go into the .conf files and edit them.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 12:44:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396196#M115026</guid>
      <dc:creator>link22</dc:creator>
      <dc:date>2018-06-19T12:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use eval for basic search terms (NOT fields)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396197#M115027</link>
      <description>&lt;P&gt;You can run something like &lt;CODE&gt;... |eval count_field = case(searchmatch("searchtermA"), "A_class",searchmatch("searchtermB"),"B_class") | stats (or chart/timechart) count by count_field&lt;/CODE&gt;. It should return the counts of both types of events. &lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 14:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396197#M115027</guid>
      <dc:creator>brendanmatthews</dc:creator>
      <dc:date>2018-06-19T14:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use eval for basic search terms (NOT fields)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396198#M115028</link>
      <description>&lt;P&gt;You can something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex "searchTermA" OR "searchTermB" | stats  count(eval(searchmatch("searchTermA"))) as CountA count(eval(searchmatch("searchTermB"))) as CountB
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jun 2018 14:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-for-basic-search-terms-NOT-fields/m-p/396198#M115028</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-06-19T14:41:32Z</dc:date>
    </item>
  </channel>
</rss>

