<?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: eval case condition in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211471#M61881</link>
    <description>&lt;P&gt;Thank you it helped a lot . &lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2017 08:46:19 GMT</pubDate>
    <dc:creator>AdixitSplunk</dc:creator>
    <dc:date>2017-01-03T08:46:19Z</dc:date>
    <item>
      <title>eval case condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211469#M61879</link>
      <description>&lt;P&gt;HI ,&lt;BR /&gt;
 I have this query where i want my data in a specific format .&lt;BR /&gt;
Here under each POD there are some 3-4 hosts ,whose total event count  is 5 ...(highlighted)&lt;BR /&gt;
Base query|stats count by host|addcoltotals                          &lt;/P&gt;

&lt;P&gt;Similarly for POD 2 i have some different set of hosts whose counts is 10 &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Expected output:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Message          POD1 POD2 Total &lt;BR /&gt;
XYZ ........ &lt;STRONG&gt;5&lt;/STRONG&gt;.............10..........          15&lt;/P&gt;

&lt;P&gt;I used  below query:&lt;BR /&gt;
index="River" sourcetype=river_logs host="XYZ" OR "host="ABC" OR host="LM" OR "host="NOP" Message="*" |eval host=upper(host)|eval env=case( host=="XYZ" OR "host="ABC","POD1",host=="LM" OR "host=="NOP","POD2",1==1,"NOT MATCHED")|stats count by host env | chart values(count) over host by env&lt;/P&gt;

&lt;P&gt;Which is giving result as :&lt;BR /&gt;
host    POD1....POD2&lt;BR /&gt;
XYZ        2&lt;BR /&gt;
LM        ...............5&lt;BR /&gt;
ABC       3&lt;BR /&gt;&lt;BR /&gt;
NOP    ............5&lt;/P&gt;

&lt;P&gt;WHICH IS NO THE expected format of result .(". "are nothing but the spaces to show how exactly result is popping)&lt;BR /&gt;
Please help me with this one &lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2017 12:39:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211469#M61879</guid>
      <dc:creator>AdixitSplunk</dc:creator>
      <dc:date>2017-01-02T12:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: eval case condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211470#M61880</link>
      <description>&lt;P&gt;Is your expected output is host being first column or Message being first column?&lt;/P&gt;

&lt;P&gt;I am not sure why have you used two statistics i.e. stats and chart when you are trying to just perform count.&lt;/P&gt;

&lt;P&gt;Following should give you the results you are expecting.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt;
| chart count by host env
| addtotals row=t col=f 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: &lt;BR /&gt;
1) If you want to reverse Column/Row split just reverse the by sequence i.e. &lt;STRONG&gt;chart count by env host&lt;/STRONG&gt;&lt;BR /&gt;
2) If you want to show column totals also then use change from col=f to &lt;STRONG&gt;col=t  labelfield=host&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2017 14:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211470#M61880</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-01-02T14:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: eval case condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211471#M61881</link>
      <description>&lt;P&gt;Thank you it helped a lot . &lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 08:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211471#M61881</guid>
      <dc:creator>AdixitSplunk</dc:creator>
      <dc:date>2017-01-03T08:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: eval case condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211472#M61882</link>
      <description>&lt;P&gt;I have just used .....chart count by env |addcolstotals |fillnull value="Total" env&lt;BR /&gt;
Its actually giving result as:&lt;/P&gt;

&lt;P&gt;env             Count&lt;BR /&gt;
POD1            5&lt;BR /&gt;
POD2             2&lt;BR /&gt;
POD3             3&lt;BR /&gt;
Total              10&lt;BR /&gt;
I want it  to be like &lt;BR /&gt;
POD1  POD2      POD3           Total &lt;BR /&gt;
5              2           3           &lt;STRONG&gt;10&lt;/STRONG&gt;&lt;BR /&gt;
I used transpose command but its giving result like:&lt;BR /&gt;
column    &lt;STRONG&gt;row1      row2    row 3&lt;/STRONG&gt;&lt;BR /&gt;
env            POD1      POD2   POD3&lt;BR /&gt;
Count          5             2           3&lt;/P&gt;

&lt;P&gt;Is it possible to make "POD1" POD2 as table header instead of row 1, row 2 etc.&lt;BR /&gt;
Please help me with this .&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 09:01:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-case-condition/m-p/211472#M61882</guid>
      <dc:creator>AdixitSplunk</dc:creator>
      <dc:date>2017-01-03T09:01:57Z</dc:date>
    </item>
  </channel>
</rss>

