<?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: My case statement is putting events in the &amp;quot;other&amp;quot; category -- why? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355673#M165945</link>
    <description>&lt;P&gt;Sorry to say but it's the same result&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2017 07:46:02 GMT</pubDate>
    <dc:creator>Subrahmanyab</dc:creator>
    <dc:date>2017-09-25T07:46:02Z</dc:date>
    <item>
      <title>My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355669#M165941</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;
So i have a user_agent and a url field for an elb log file. I am checking the user agent field for the values that contain Googlebot and Bingbot. If the useragent field has either of these values i want them to be displayed in the results as google_bot and bing_bot, otherwise the events that dont match either of these conditions should fall under the other category. My problem is when the search finalizes, it ends up sticking every event in the other category, but while it is running the search, it splits them by the proper category that i want (google_bot,bing_bot, other). I don' understand why my case statement default to putting every event in the other category. I have tried multiple commands, shown below, but they all end with the same results where every event is placed in the other category. Can anyone help me understand why it is doing this?&lt;/P&gt;

&lt;P&gt;index=vgl | eval bot= coalesce(case(user_agent LIKE "%google%", "google_bot", user_agent LIKE "%bing%","bing_bot"), "other")|chart count(bot) AS count_bot by url, bot usenull=false&lt;/P&gt;

&lt;P&gt;index=vgl | eval bot= case(user_agent LIKE "%google%", "google_bot", user_agent LIKE "%bing%","bing_bot", True(), "other")|chart count(bot) AS count_bot by url, bot usenull=false&lt;/P&gt;

&lt;P&gt;index=vgl | eval bot= case(user_agent LIKE "%google%", "google_bot", user_agent LIKE "%bing%","bing_bot", 1=1, "other")|chart count(bot) AS count_bot by url, bot usenull=false&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This is what how I want my results&lt;/STRONG&gt;&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/217625-1.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This is by the time it finalizes the job&lt;/STRONG&gt;&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/217626-2.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355669#M165941</guid>
      <dc:creator>Subrahmanyab</dc:creator>
      <dc:date>2020-09-29T15:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355670#M165942</link>
      <description>&lt;P&gt;HI Subrahmanyab,&lt;BR /&gt;
did you tried with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=vgl 
| eval bot=case(user_agent LIKE "%google%", "google_bot", user_agent LIKE "%bing%","bing_bot", NOT (user_agent LIKE "%google%" OR  user_agent LIKE "%bing%"), "other")
| chart count(bot) AS count_bot by url, bot usenull=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2017 06:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355670#M165942</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-23T06:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355671#M165943</link>
      <description>&lt;P&gt;HI Gluseppe,&lt;/P&gt;

&lt;P&gt;Thank you for the response I tried your command but the result is the same &lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 06:34:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355671#M165943</guid>
      <dc:creator>Subrahmanyab</dc:creator>
      <dc:date>2017-09-25T06:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355672#M165944</link>
      <description>&lt;P&gt;HI Subrahmanyab,&lt;BR /&gt;
Sorry, I was sleeping yesterday morning, please try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=vgl 
 | eval bot=case(like(user_agent,"%google%"), "google_bot",like(user_agent,"%bing%"),"bing_bot",1=1, "other")
 | chart count(bot) AS count_bot by url, bot usenull=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 06:45:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355672#M165944</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-25T06:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355673#M165945</link>
      <description>&lt;P&gt;Sorry to say but it's the same result&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 07:46:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355673#M165945</guid>
      <dc:creator>Subrahmanyab</dc:creator>
      <dc:date>2017-09-25T07:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355674#M165946</link>
      <description>&lt;P&gt;HI Subrahmanyab,&lt;BR /&gt;
to debug problem see events (running search in verbose mode or without chart command) and see if bot field has values ("google_bot", "bing_bot", "other") for all events or not, in this way you can understand if the eval command is correct (100%) or not.&lt;/P&gt;

&lt;P&gt;if it's correct, you have to debug chart command.&lt;/P&gt;

&lt;P&gt;Eval command in my example is correctly valorized, try to modify chart command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=vgl 
  | eval bot=case(like(user_agent,"%google%"), "google_bot",like(user_agent,"%bing%"),"bing_bot",1=1, "other")
  | chart count over url BY bot
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:51:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355674#M165946</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T15:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355675#M165947</link>
      <description>&lt;P&gt;How come you marked this as accepted when it does not work?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 08:00:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355675#M165947</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2017-09-25T08:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: My case statement is putting events in the "other" category -- why?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355676#M165948</link>
      <description>&lt;P&gt;thank you,  cusello, It is working now, I removed my index file and re loaded the index and now it is working &lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 14:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/My-case-statement-is-putting-events-in-the-quot-other-quot/m-p/355676#M165948</guid>
      <dc:creator>Subrahmanyab</dc:creator>
      <dc:date>2017-09-25T14:53:01Z</dc:date>
    </item>
  </channel>
</rss>

