<?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: rename the search results for multiple conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477424#M133983</link>
    <description>&lt;P&gt;That stats command only works for events with both MANAGER_NAME1  and MANAGER_NAME2 fields populated. I'm guessing that is not the case?&lt;/P&gt;

&lt;P&gt;Also: your first case statement is missing the &lt;CODE&gt;"&lt;/CODE&gt; characters around the &lt;CODE&gt;XZ*&lt;/CODE&gt; etc.&lt;BR /&gt;
Also: &lt;CODE&gt;MANAGER_NAME=="XZ*" OR MANAGER_NAME=="X*"  OR MANAGER_NAME=="XY"&lt;/CODE&gt; is a bit silly. Since you include "X*" as one of the options, that already covers the other two cases.&lt;BR /&gt;
Anyway, you cannot use wildcards there.&lt;/P&gt;

&lt;P&gt;You'd probably want to put it all into 1 case statement and use the &lt;CODE&gt;match()&lt;/CODE&gt; function. E.g.:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=alarms sourcetype=ommc_alarms APPLICATION=spk OR APPLICATION=*spk3*
| eval MANAGER_NAME1=case(match(MANAGER_NAME,"^X.*"),"Prd",match(AMONAME,"^YL.*"),Dev,match(AMONAME,"^ZN.*"),QAT) 
| stats count by MANAGER_NAME1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that is not what you are after, please describe in more detail what your data looks like and what the result would be that you want out of this.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 02:51:41 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2020-09-30T02:51:41Z</dc:date>
    <item>
      <title>rename the search results for multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477423#M133982</link>
      <description>&lt;P&gt;Hello, I'm trying to rename query output and those are string values.&lt;BR /&gt;
expecting output for field MANAGER_NAME would be like below,&lt;BR /&gt;
&lt;CODE&gt;XZ* = PRD&lt;BR /&gt;
X* = PRD&lt;BR /&gt;
XY = PRD&lt;BR /&gt;
YL = DEV&lt;BR /&gt;
ZN = QAT&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;tried with below query but it's not working any suggestions?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=alarms sourcetype=ommc_alarms APPLICATION=spk OR APPLICATION=*spk3* | eval MANAGER_NAME1=case(MANAGER_NAME==XZ* OR MANAGER_NAME==X*  OR MANAGER_NAME==XY,"Prd") | eval MANAGER_NAME2=case(AMONAME=="YL*",Dev,AMONAME=="ZN*",QAT) 
 | stats count by MANAGER_NAME1 ,MANAGER_NAME2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Nov 2019 05:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477423#M133982</guid>
      <dc:creator>nagarajsf</dc:creator>
      <dc:date>2019-11-08T05:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: rename the search results for multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477424#M133983</link>
      <description>&lt;P&gt;That stats command only works for events with both MANAGER_NAME1  and MANAGER_NAME2 fields populated. I'm guessing that is not the case?&lt;/P&gt;

&lt;P&gt;Also: your first case statement is missing the &lt;CODE&gt;"&lt;/CODE&gt; characters around the &lt;CODE&gt;XZ*&lt;/CODE&gt; etc.&lt;BR /&gt;
Also: &lt;CODE&gt;MANAGER_NAME=="XZ*" OR MANAGER_NAME=="X*"  OR MANAGER_NAME=="XY"&lt;/CODE&gt; is a bit silly. Since you include "X*" as one of the options, that already covers the other two cases.&lt;BR /&gt;
Anyway, you cannot use wildcards there.&lt;/P&gt;

&lt;P&gt;You'd probably want to put it all into 1 case statement and use the &lt;CODE&gt;match()&lt;/CODE&gt; function. E.g.:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=alarms sourcetype=ommc_alarms APPLICATION=spk OR APPLICATION=*spk3*
| eval MANAGER_NAME1=case(match(MANAGER_NAME,"^X.*"),"Prd",match(AMONAME,"^YL.*"),Dev,match(AMONAME,"^ZN.*"),QAT) 
| stats count by MANAGER_NAME1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that is not what you are after, please describe in more detail what your data looks like and what the result would be that you want out of this.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477424#M133983</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2020-09-30T02:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: rename the search results for multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477425#M133984</link>
      <description>&lt;P&gt;Hello @FrankVl ,&lt;/P&gt;

&lt;P&gt;Added example values above query.&lt;BR /&gt;
 I trying as you suggested but it giving me only first value &lt;CODE&gt;Prd&lt;/CODE&gt;, but I need all matching values to &lt;CODE&gt;Prod, Dev, QAT&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=alarms sourcetype=ommc_alarms APPLICATION=spk OR APPLICATION=*spk3* | eval MANAGER_NAME1=case(match(MANAGER_NAME,"^prdplhdpx*"),"Prd",match(AMONAME,"^qatehdp*"),"Dev",match(AMONAME,"^devehdp*"),"QAT") 
 | stats count by MANAGER_NAME1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to create a dropdown dashboard based on selection of the environment. &lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 18:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477425#M133984</guid>
      <dc:creator>nagarajsf</dc:creator>
      <dc:date>2019-11-08T18:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: rename the search results for multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477426#M133985</link>
      <description>&lt;P&gt;If that search only gives you a Prd result, there is probably something incorrect in the criteria of the case statement. Note: match uses regular expressions, which are case sensitive.&lt;/P&gt;

&lt;P&gt;Run the search without the &lt;CODE&gt;stats count&lt;/CODE&gt; part and see if the &lt;CODE&gt;MANAGER_NAME1&lt;/CODE&gt; is populated correctly for all events.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 09:11:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477426#M133985</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-11-11T09:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: rename the search results for multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477427#M133986</link>
      <description>&lt;P&gt;Yes, I ran query without or with &lt;CODE&gt;stats count&lt;/CODE&gt;, in both cases, it is giving value of which match provided in the case. &lt;/P&gt;

&lt;P&gt;For instance if I gave  &lt;CODE&gt;match(MANAGER_NAME,"^prdplhdpx*"),"Prd"&lt;/CODE&gt; in a first place of &lt;CODE&gt;case&lt;/CODE&gt; then giving matched value of it and its not considering other match options, &lt;CODE&gt;match(AMONAME,"^qatehdp*"),"Dev",match(AMONAME,"^devehdp*"),"QAT")&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;basically &lt;CODE&gt;MANAGER_NAME1&lt;/CODE&gt; value is populating first match of  &lt;CODE&gt;case&lt;/CODE&gt;  and it's ignoring other options&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 21:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477427#M133986</guid>
      <dc:creator>nagarajsf</dc:creator>
      <dc:date>2019-11-15T21:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: rename the search results for multiple conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477428#M133987</link>
      <description>&lt;P&gt;Can you show a sample of your data showing the MANAGER_NAME and AMONAME fields and the result of the case statement as it is put into MANAGER_NAME1?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:05:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rename-the-search-results-for-multiple-conditions/m-p/477428#M133987</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2020-09-30T03:05:50Z</dc:date>
    </item>
  </channel>
</rss>

