<?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 using token for span in timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264157#M189823</link>
    <description>&lt;P&gt;Hi vinay4444, I believe something like this will work, referencing the documentation on case : &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/CommonEvalFunctions#Comparison_and_Conditional_functions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/CommonEvalFunctions#Comparison_and_Conditional_functions&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX sourcetype="XXX" itemKey ="$metric$" name = "$Host$" | timechart [ eval spantime="span=".case(itemKey=="x",10,itemKey=="y",1)."m" | return $spantime ] $statistic$(value) by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Guessing you are spanning in minutes, so concatenated an m to the end, but you could modify that or build it into the case statement.&lt;/P&gt;

&lt;P&gt;Let me know how this works!&lt;/P&gt;</description>
    <pubDate>Mon, 12 Oct 2015 14:27:38 GMT</pubDate>
    <dc:creator>muebel</dc:creator>
    <dc:date>2015-10-12T14:27:38Z</dc:date>
    <item>
      <title>case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264155#M189821</link>
      <description>&lt;P&gt;index=XXX  sourcetype="XXX" itemKey ="$metric$" name = "$Host$" | timechart span=$spantime$m  $statistic$(value) by name&lt;/P&gt;

&lt;P&gt;how can i add logic for $spantime$ to take values based on itemkey value &lt;BR /&gt;
case itemKey = "x" then 10&lt;BR /&gt;
case itemKey = "y" then 1 ?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 13:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264155#M189821</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2015-10-12T13:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264156#M189822</link>
      <description>&lt;P&gt;I'm not sure the timechart command will work with variable substitution, but if it does it will be something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX sourcetype="XXX" itemKey ="$metric$" name = "$Host$" | eval spantime=case(itemKey="x",10, itemKey="y",1, 1=1,1) | timechart span=$spantime$m $statistic$(value) by name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Oct 2015 14:27:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264156#M189822</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-10-12T14:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264157#M189823</link>
      <description>&lt;P&gt;Hi vinay4444, I believe something like this will work, referencing the documentation on case : &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/CommonEvalFunctions#Comparison_and_Conditional_functions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/CommonEvalFunctions#Comparison_and_Conditional_functions&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX sourcetype="XXX" itemKey ="$metric$" name = "$Host$" | timechart [ eval spantime="span=".case(itemKey=="x",10,itemKey=="y",1)."m" | return $spantime ] $statistic$(value) by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Guessing you are spanning in minutes, so concatenated an m to the end, but you could modify that or build it into the case statement.&lt;/P&gt;

&lt;P&gt;Let me know how this works!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 14:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264157#M189823</guid>
      <dc:creator>muebel</dc:creator>
      <dc:date>2015-10-12T14:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264158#M189824</link>
      <description>&lt;P&gt;thanks for the response i tried both methods but could not see change in span value &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;index=xxx  sourcetype="xxx" itemKey ="$metric$" name = "$Host$" | timechart [ eval spantime="span=".case(itemKey=="ms.db.cpu_usage_percent*",1,itemKey=="ms.db.connection_count",10)."m" | return $spantime ] SUM(value) by name&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264158#M189824</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2020-09-29T07:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264159#M189825</link>
      <description>&lt;P&gt;whats the literal search look like in the job inspector?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 15:27:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264159#M189825</guid>
      <dc:creator>muebel</dc:creator>
      <dc:date>2015-10-12T15:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264160#M189826</link>
      <description>&lt;P&gt;index=xxx  sourcetype="xxx" itemKey ="$metric$" name = "$Host$" | timechart span=$spantime$m  $statistic$(value) by name&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 15:29:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264160#M189826</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2015-10-12T15:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: case statement using token for span in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264161#M189827</link>
      <description>&lt;P&gt;based on value selected by user in itemKey we need to set the spantime for time chart&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 15:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-statement-using-token-for-span-in-timechart/m-p/264161#M189827</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2015-10-12T15:32:13Z</dc:date>
    </item>
  </channel>
</rss>

