<?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: Case Statement Issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490813#M137033</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;P&gt;| eval Timenow=now()&lt;BR /&gt;
| convert timeformat="%Y/%m/%d" mktime(_time) as date_provisioned&lt;BR /&gt;
| eval days_since_provisioned=Timenow-floor(date_provisioned)&lt;BR /&gt;
| eval bucket=case(days_since_provisioned&amp;lt;=179, "Less Than 180", days_since_provisioned&amp;lt;=210, "180-210", days_sinced_provisioned&amp;gt;=210, "Greater Than 210")&lt;BR /&gt;
| chart count by bucket&lt;/P&gt;

&lt;P&gt;I do not think you had your &lt;CODE&gt;date_provisioned&lt;/CODE&gt; field is configured in your last search so that screwed up your &lt;CODE&gt;days_since_provisioned&lt;/CODE&gt; eval.&lt;/P&gt;

&lt;P&gt;I created a date_provisioned field using the &lt;CODE&gt;convert timeformat=... mktime(_time) as date_provisioned&lt;/CODE&gt;. Then added in the rest of your search with some minor tweaks.&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:48:28 GMT</pubDate>
    <dc:creator>13tsavage</dc:creator>
    <dc:date>2020-09-30T03:48:28Z</dc:date>
    <item>
      <title>Case Statement Issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490810#M137030</link>
      <description>&lt;P&gt;I'm Having issues with my case statement.&lt;/P&gt;

&lt;P&gt;index=sti_123 source=rss_servers  active = "1" status = "Being Commissioned"&lt;/P&gt;

&lt;P&gt;| eval Timenow=now()&lt;BR /&gt;
| eval days_since_provisioned = Timenow - date_provisioned&lt;BR /&gt;
| eval bucket = case(days_since_provisioned &amp;lt;=179, "Less Than 180", days_since_provisioned &amp;lt;= 210, "180-210", days_sinced_provisioned &amp;gt;= 210, "Greater Than 210")&lt;BR /&gt;
| chart count by bucket&lt;/P&gt;

&lt;P&gt;I believe it is the bucket case statement that is the issue, because I remove the "By bucket" and it gives me the correct total, but I just need to be able to say X server has been in this stage for A B or C length&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:48:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490810#M137030</guid>
      <dc:creator>Bbyers3</dc:creator>
      <dc:date>2020-09-30T03:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490811#M137031</link>
      <description>&lt;P&gt;"bucket" is a search command and could be skewing your results.  try renaming your "bucket" to "mybucket" and see if that helps.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 20:16:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490811#M137031</guid>
      <dc:creator>jimodonald</dc:creator>
      <dc:date>2020-01-23T20:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490812#M137032</link>
      <description>&lt;P&gt;This, and also please check your case statement because you have one field named &lt;STRONG&gt;days_sinced_provisioned&lt;/STRONG&gt; in there.&lt;/P&gt;

&lt;P&gt;A best practice here is to have a pair at the end:&lt;BR /&gt;
&lt;CODE&gt;1==1,"Other"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will help you identify cases where you have a logic hole, or maybe events that don't have a time value, and therefore won't participate in your counts.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490812#M137032</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-09-30T03:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Case Statement Issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490813#M137033</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;P&gt;| eval Timenow=now()&lt;BR /&gt;
| convert timeformat="%Y/%m/%d" mktime(_time) as date_provisioned&lt;BR /&gt;
| eval days_since_provisioned=Timenow-floor(date_provisioned)&lt;BR /&gt;
| eval bucket=case(days_since_provisioned&amp;lt;=179, "Less Than 180", days_since_provisioned&amp;lt;=210, "180-210", days_sinced_provisioned&amp;gt;=210, "Greater Than 210")&lt;BR /&gt;
| chart count by bucket&lt;/P&gt;

&lt;P&gt;I do not think you had your &lt;CODE&gt;date_provisioned&lt;/CODE&gt; field is configured in your last search so that screwed up your &lt;CODE&gt;days_since_provisioned&lt;/CODE&gt; eval.&lt;/P&gt;

&lt;P&gt;I created a date_provisioned field using the &lt;CODE&gt;convert timeformat=... mktime(_time) as date_provisioned&lt;/CODE&gt;. Then added in the rest of your search with some minor tweaks.&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:48:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Case-Statement-Issue/m-p/490813#M137033</guid>
      <dc:creator>13tsavage</dc:creator>
      <dc:date>2020-09-30T03:48:28Z</dc:date>
    </item>
  </channel>
</rss>

