<?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: Help with case statement affected by a transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209308#M61148</link>
    <description>&lt;P&gt;&lt;CODE&gt;transaction&lt;/CODE&gt; command creates multi-value fields and you need to use &lt;CODE&gt;mv&lt;/CODE&gt; functions to manipulate the data. In your example you may want to look at &lt;CODE&gt;mvfilter()&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Parsemultivaluefields"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Search/Parsemultivaluefields&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 22:00:52 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-06-13T22:00:52Z</dc:date>
    <item>
      <title>Help with case statement affected by a transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209307#M61147</link>
      <description>&lt;P&gt;Each of the events in my log files has a data value for example, Data = a&lt;BR /&gt;
I am using a transaction to group my events from start to end but I want to use eval and a case statement to create another variable that can describe the transaction.&lt;/P&gt;

&lt;P&gt;For example,&lt;BR /&gt;
Event1: Data = start&lt;BR /&gt;
Event2: Data = c&lt;BR /&gt;
Event3: Data = a&lt;BR /&gt;
Event4: Data = a&lt;BR /&gt;
Event4: Data = end&lt;/P&gt;

&lt;P&gt;So for this example, I want a variable named poles that would be "ac" since a and c are the only distinct data in my transaction.&lt;/P&gt;

&lt;P&gt;Currently I have &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... |transaction startswith = "start" endswith = "end"
|eval poles = case(Data=="a" AND Data=="b" AND Data=="c" AND Data=="d", "abcd", Data=="a" AND Data=="b", "ab", ... , 1==1, "Other")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My case statement has many different cases to fit the different combination for 4 different possible values for Data and one general case for "Other" in case no other cases fit. When I tested my search, each transaction came back as "Other" when none of them should be. I was hoping that testing for Data=="a" AND Data=="c" and similar statements would account for any event in the transaction would make this true like how the example has Event3 with Data = a, and Event2 with Data = c to get the desired poles string. But it seems that the case statement is checking individual events to see if that one event fits all the conditional logic criteria (which it clearly doesn't) so it defaults to "Other"&lt;/P&gt;

&lt;P&gt;I'm not quite sure how else to check for distinct Data values (as some events have data that I don't care about, just the specific 4: a,b,c,d) and be able to output a new variable to display which are the distinct values in a transaction.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 21:29:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209307#M61147</guid>
      <dc:creator>jxiongjx</dc:creator>
      <dc:date>2016-06-13T21:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with case statement affected by a transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209308#M61148</link>
      <description>&lt;P&gt;&lt;CODE&gt;transaction&lt;/CODE&gt; command creates multi-value fields and you need to use &lt;CODE&gt;mv&lt;/CODE&gt; functions to manipulate the data. In your example you may want to look at &lt;CODE&gt;mvfilter()&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Parsemultivaluefields"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Search/Parsemultivaluefields&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 22:00:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209308#M61148</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-13T22:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with case statement affected by a transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209309#M61149</link>
      <description>&lt;P&gt;Thanks! this worked perfectly&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 15:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-case-statement-affected-by-a-transaction/m-p/209309#M61149</guid>
      <dc:creator>jxiongjx</dc:creator>
      <dc:date>2016-06-14T15:15:36Z</dc:date>
    </item>
  </channel>
</rss>

