<?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: Is it possible to use if else condition based on the search to create stats? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472132#M132843</link>
    <description>&lt;P&gt;I am trying to create a dashboard with deployments during the month based on projects as dropdown fields using Column graph&lt;/P&gt;

&lt;P&gt;this is my query for the dashboard.&lt;/P&gt;

&lt;P&gt;index="concourse" sourcetype="deployments: csv" month="$mt$" project="$project$" | stats count by project, month&lt;/P&gt;

&lt;P&gt;This basically gives me the count for the deployments by project&lt;/P&gt;

&lt;P&gt;with the above query if i choose &lt;BR /&gt;
Project = ALL and Month=February&lt;/P&gt;

&lt;P&gt;This is basically showing the data correctly in the graph wit proper name [like a, b, c projects deployed during this month]&lt;/P&gt;

&lt;P&gt;When I choose Project=BUY and Month=ALL&lt;BR /&gt;
Then it is populating the results but showing as [BUY,BUY,BUY,BUY] on x-axis and count on y-axis and not displaying the month&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2019 19:44:44 GMT</pubDate>
    <dc:creator>nukarajusundeep</dc:creator>
    <dc:date>2019-10-30T19:44:44Z</dc:date>
    <item>
      <title>Is it possible to use if else condition based on the search to create stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472130#M132841</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=concourse
sourcetype="deployments: csv"
if project = * and team=$team$ | stats count by project, team
elif team=* and project=$project$ | stats count by team, project
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can we do something like this in Splunk search?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 19:03:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472130#M132841</guid>
      <dc:creator>nukarajusundeep</dc:creator>
      <dc:date>2019-10-30T19:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use if else condition based on the search to create stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472131#M132842</link>
      <description>&lt;P&gt;Where is the data that is going to populate the two tokens you have in your search coming from?  Is that streaming from the search that returns with your &lt;CODE&gt;index=concourse sourcetype="deployments: csv"&lt;/CODE&gt; part of the query?  Also what is your ultimate goal,  Are you trying to say, if project is not null and team equals token team stats count by project, team, else if team is not null and project equals token project stats count by team project?  Are you doing this because the project/team field is sometimes null?  Can you mock up the output you are looking for?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 19:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472131#M132842</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-10-30T19:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use if else condition based on the search to create stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472132#M132843</link>
      <description>&lt;P&gt;I am trying to create a dashboard with deployments during the month based on projects as dropdown fields using Column graph&lt;/P&gt;

&lt;P&gt;this is my query for the dashboard.&lt;/P&gt;

&lt;P&gt;index="concourse" sourcetype="deployments: csv" month="$mt$" project="$project$" | stats count by project, month&lt;/P&gt;

&lt;P&gt;This basically gives me the count for the deployments by project&lt;/P&gt;

&lt;P&gt;with the above query if i choose &lt;BR /&gt;
Project = ALL and Month=February&lt;/P&gt;

&lt;P&gt;This is basically showing the data correctly in the graph wit proper name [like a, b, c projects deployed during this month]&lt;/P&gt;

&lt;P&gt;When I choose Project=BUY and Month=ALL&lt;BR /&gt;
Then it is populating the results but showing as [BUY,BUY,BUY,BUY] on x-axis and count on y-axis and not displaying the month&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 19:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472132#M132843</guid>
      <dc:creator>nukarajusundeep</dc:creator>
      <dc:date>2019-10-30T19:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use if else condition based on the search to create stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472133#M132844</link>
      <description>&lt;P&gt;Gotcha.  You may want to consider using chart instead of stats for this use case:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="concourse" sourcetype="deployments: csv" month="$mt$" project="$project$"
| chart count over month by project
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will make it so month is always the x-axis and your columns will be different projects.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 20:03:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472133#M132844</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-10-30T20:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use if else condition based on the search to create stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472134#M132845</link>
      <description>&lt;P&gt;I'm not sure if it will get you what you need, but you can wrap an eval inside of a stats function.&lt;BR /&gt;
count(eval(team=$team$ AND project=*))&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 21:35:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-if-else-condition-based-on-the-search-to/m-p/472134#M132845</guid>
      <dc:creator>anthonymelita</dc:creator>
      <dc:date>2019-10-30T21:35:50Z</dc:date>
    </item>
  </channel>
</rss>

