<?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: Issues with Case statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370323#M165166</link>
    <description>&lt;P&gt;This did address the issue of the comparison, but renaming the requestParameters.policyArn field, as suggested by kamlish provided the results I was seeking.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 14:59:20 GMT</pubDate>
    <dc:creator>tgrogan_stack</dc:creator>
    <dc:date>2017-11-15T14:59:20Z</dc:date>
    <item>
      <title>Issues with Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370319#M165162</link>
      <description>&lt;P&gt;I have reviewed a number of already answered questions related to case statements but none that seem to address the issue I am having.  I am trying to create a table to show AWS CloudTrail events associated with creating, deleting, modifying IAM groups in AWS.&lt;/P&gt;

&lt;P&gt;I have no problem with basic details but I am attempting to use a case statement so I can display additional detail for events associated with attaching or detaching a policy to a group, namely the policy that is being attached or detached.&lt;/P&gt;

&lt;P&gt;Here is my search string, and the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="aws:cloudtrail" eventName= *Group* 
| eval Detail=case(eventName == DetachGroupPolicy, requestParameters.policyArn, eventName == AttachGroupPolicy, requestParameters.policyArn, 1=1, "N/A" ) 
| rename requestParameters.groupName as Group, userIdentity.userName as "Performed by" 
| table _time, eventName, Group, Detail, requestParameters.policyArn
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;RESULTS:&lt;BR /&gt;
| _time                                               | eventName               | Group         | Detail | requestParameters.policyArn                    |&lt;BR /&gt;
|--------------------------------------------|-----------------------------|------------------|----------|-----------------------------------------------------------|&lt;BR /&gt;
| 2017-11-14T13:01:30.000-0700 | DeleteGroup             | TestGroup | N/A    |                                                                           |&lt;BR /&gt;
| 2017-11-14T13:01:30.000-0700 | DetachGroupPolicy  | TestGroup | N/A    | arn:aws:iam::aws:policy/ReadOnlyAccess |&lt;BR /&gt;
| 2017-11-14T13:01:19.000-0700 | UpdateGroup            | tst_grp        | N/A    |                                                                           |&lt;BR /&gt;
| 2017-11-14T13:00:40.000-0700 | AttachGroupPolicy   | tst_grp        | N/A    | arn:aws:iam::aws:policy/ReadOnlyAccess |&lt;BR /&gt;
| 2017-11-14T13:00:40.000-0700 | CreateGroup             | tst_grp        | N/A    |                                                                           |&lt;/P&gt;

&lt;P&gt;It seems that none of my case comparisons are evaluating to true.  I've included the policyArn field to ensure it is actually populated and there are no typos.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:47:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370319#M165162</guid>
      <dc:creator>tgrogan_stack</dc:creator>
      <dc:date>2020-09-29T16:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370320#M165163</link>
      <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;P&gt;| eval Detail=case(eventName == "DetachGroupPolicy", requestParameters.policyArn, eventName == "AttachGroupPolicy", requestParameters.policyArn, 1=1, "N/A" ) &lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 04:49:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370320#M165163</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-11-15T04:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370321#M165164</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="aws:cloudtrail" eventName= *Group* 
| rename requestParameters.policyArn As requestParameters_policyArn,requestParameters.groupName as Group, userIdentity.userName as "Performed by"
| eval Detail=case(eventName=="DetachGroupPolicy" OR eventNam =="AttachGroupPolicy" ,requestParameters_policyArn, 1=1, "N/A" )
| table _time, eventName, Group, Detail, requestParameters_policyArn
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 04:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370321#M165164</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-15T04:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370322#M165165</link>
      <description>&lt;P&gt;Renaming requestParameters.policyArn worked.  Thank you.&lt;/P&gt;

&lt;P&gt;Please post this as an answer so I can mark it as the accepted answer.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 14:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370322#M165165</guid>
      <dc:creator>tgrogan_stack</dc:creator>
      <dc:date>2017-11-15T14:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370323#M165166</link>
      <description>&lt;P&gt;This did address the issue of the comparison, but renaming the requestParameters.policyArn field, as suggested by kamlish provided the results I was seeking.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 14:59:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370323#M165166</guid>
      <dc:creator>tgrogan_stack</dc:creator>
      <dc:date>2017-11-15T14:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370324#M165167</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/73927"&gt;@tgrogan_stack&lt;/a&gt;, please accept &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;'s answer to mark this question as answered.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:44:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-with-Case-statement/m-p/370324#M165167</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T16:44:11Z</dc:date>
    </item>
  </channel>
</rss>

