<?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: How to use differnt Eval statement for the same column in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54476#M179742</link>
    <description>&lt;P&gt;Try putting prod and dev in quotations.&lt;/P&gt;

&lt;P&gt;If that doesn't work please paste your new search string here&lt;/P&gt;</description>
    <pubDate>Fri, 07 Sep 2012 16:15:37 GMT</pubDate>
    <dc:creator>MHibbin</dc:creator>
    <dc:date>2012-09-07T16:15:37Z</dc:date>
    <item>
      <title>How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54472#M179738</link>
      <description>&lt;P&gt;Hello everyone, I am trying to create a search that will tell me yesterdays total usage. We have both a dev and a production enviornment and i would like to create a search that takes the 2GB that are allocated to the dev and the 19 GB that are allocated to the production and show a percentage based off of that. Where i have ((volume/18)*100) is applied to both the dev and the prod and gives it a wrong number for the dev since i only want to divide by 2. Does anyone have any idea of how to seperate the eval statement that I have so that one is attached to dev ((volume/2)*100) and the other to production ((volume/18)*100).   This will give me the proper percentages, or maybe another way to do this. Thank you,&lt;/P&gt;

&lt;P&gt;Here is my Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=*license_usage* type=Usage | eval GB=b/1024/1024/1024  | bucket _time span=1d | stats sum(GB) AS volume by _time pool | eval percent_difference=((volume/18)*100) |fields _time pool volume percent_difference|rename _time AS Date/Time pool AS Pool volume AS Volume(GB) percent_difference AS Percent(%)| convert timeformat="%m/%d/%Y %H:%M:%S %p" ctime(Date/Time)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Updated Serach: ( Still having problem on getting the percentages to display)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal source=license_usage type=Usage | eval GB=b/1024/1024/1024| eval Percent(%)=case(type="Splunk Development",((volume/2)*100), type="auto_generated_pool_enterprise",((volume/18)*100))   | bucket _time span=1d | stats sum(GB) AS volume by _time pool |fields _time pool volume percent_difference|rename _time AS Date/Time pool AS Pool volume AS Volume(GB) percent_difference AS Percent(%)| convert timeformat="%m/%d/%Y %H:%M:%S %p" ctime(Date/Time) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:24:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54472#M179738</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2020-09-28T12:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54473#M179739</link>
      <description>&lt;P&gt;if you have a another column/field that defines production/development (you could always create one using eval and case statements), you could use that field in a case statement, something like&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;..| eval percent_difference=case(type==prod,((volume/18)*100), type==dev, ((volume/2)*100))|..&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eval"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eval&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;MHibbin&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 15:57:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54473#M179739</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-09-07T15:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54474#M179740</link>
      <description>&lt;P&gt;Thank you, I was just thinking maybe i can create another static field that just has 18 and 2 in them and divide volume by that, but i am not sure how to create a static number that is not in the log files. Im going to give what you said a shot. Thank you again.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 15:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54474#M179740</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-09-07T15:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54475#M179741</link>
      <description>&lt;P&gt;I am getting a weird error when I place that into my search:&lt;/P&gt;

&lt;P&gt;Error in 'eval' command: The expression is malformed. Expected ).&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 16:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54475#M179741</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-09-07T16:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54476#M179742</link>
      <description>&lt;P&gt;Try putting prod and dev in quotations.&lt;/P&gt;

&lt;P&gt;If that doesn't work please paste your new search string here&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 16:15:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54476#M179742</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-09-07T16:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54477#M179743</link>
      <description>&lt;P&gt;I have figured it out so i do not get the error, but it is still not returning results. The updates search is in the original question. Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 17:23:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54477#M179743</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-09-07T17:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use differnt Eval statement for the same column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54478#M179744</link>
      <description>&lt;P&gt;This is still not working, Any other suggestions.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2012 18:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-differnt-Eval-statement-for-the-same-column/m-p/54478#M179744</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-09-10T18:20:26Z</dc:date>
    </item>
  </channel>
</rss>

