<?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 inside map in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645456#M223486</link>
    <description>&lt;P&gt;Yup, that's what I said it would do.&amp;nbsp; If you need to use &lt;FONT face="courier new,courier"&gt;OR&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;AND&lt;/FONT&gt; then the &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt; command will let you do so.&amp;nbsp; See the Search Reference Manual for details.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jun 2023 00:20:04 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-06-02T00:20:04Z</dc:date>
    <item>
      <title>Can I search eval case inside map?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645411#M223466</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nothing is returned for SOT (assuming NULL). &amp;nbsp;I don't understand what could be wrong. &amp;nbsp;If I run the mstats command as a standalone search it works as expected so I'm guessing it's because it's inside this map command? &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|inputlookup blah.csv
| dedup ArrayName
| map maxsearches=1000 search="
  |mstats avg(some.statistic) WHERE index=myindex AND Array_Name=$ArrayName$ by sgname Array_Name Model
  |eval SOT=case(Model="ModelA", 94000, Model="ModelB", 104000), PctIOPS=round((sgIOPS/SOT)*100, 2)
  | sort - PctIOPS
  | head 5
  | table Array_Name Model SOT sgname PctIOPS&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 06:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645411#M223466</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2023-06-02T06:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: eval case inside map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645426#M223470</link>
      <description>&lt;P&gt;I'll let someone else comment on how &lt;FONT face="courier new,courier"&gt;mstats&lt;/FONT&gt; works with &lt;FONT face="courier new,courier"&gt;map&lt;/FONT&gt;.&amp;nbsp; I have an alternative query to try.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(some.statistic) WHERE index=myindex AND [|inputlookup blah.csv
| dedup ArrayName | fields ArrayName | format ] by sgname Array_Name Model
| eval SOT=case(Model="ModelA", 94000, Model="ModelB", 104000), PctIOPS=round((sgIOPS/SOT)*100, 2)
| sort - PctIOPS
| head 5
| table Array_Name Model SOT sgname PctIOPS&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 18:57:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645426#M223470</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-06-01T18:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: eval case inside map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645442#M223476</link>
      <description>&lt;P&gt;That works great. &amp;nbsp;Now is there also a way to grab a couple more values per ArrayName out of the lookup file? &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So instead of the table command being:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| table Array_Name Model SOT sgname PctIOPS&lt;/LI-CODE&gt;&lt;P&gt;it might be:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| table Array_Name Model SOT sgname PctIOPS avgIOPS avg_pred_IOPS&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Where avgIOPS and avg_pred_IOPS are fields in the lookup file? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 20:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645442#M223476</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2023-06-01T20:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: eval case inside map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645444#M223478</link>
      <description>&lt;P&gt;Change the &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; command in the subsearch to return the desired fields.&amp;nbsp; Splunk will expect to find all of the named fields in each event.&amp;nbsp; Also, the names must match what is in the index.&amp;nbsp; If they don't match then insert a &lt;FONT face="courier new,courier"&gt;rename&lt;/FONT&gt; command before &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 21:10:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645444#M223478</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-06-01T21:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: eval case inside map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645446#M223479</link>
      <description>&lt;P&gt;Yes I did use a rename. &amp;nbsp;This is what I'm trying but it doesn't find any results now. &amp;nbsp;The fields command adds an 'AND' to the parenthetical filtering (Array_Name="x" AND avgIOPS=123)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields ArrayName avgIOPS
| rename ArrayName as Array_Name 
| format ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2023 21:28:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645446#M223479</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2023-06-01T21:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: eval case inside map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645456#M223486</link>
      <description>&lt;P&gt;Yup, that's what I said it would do.&amp;nbsp; If you need to use &lt;FONT face="courier new,courier"&gt;OR&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;AND&lt;/FONT&gt; then the &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt; command will let you do so.&amp;nbsp; See the Search Reference Manual for details.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 00:20:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645456#M223486</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-06-02T00:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: eval case inside map</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645487#M223496</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You can use&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| format "(" "" "OR" "" "" ")"&lt;/LI-CODE&gt;&lt;P&gt;or change "(" and ")" to ""&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 07:21:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-search-eval-case-inside-map/m-p/645487#M223496</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-06-02T07:21:36Z</dc:date>
    </item>
  </channel>
</rss>

