<?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: Comparing previous event field value to another event field value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336134#M99801</link>
    <description>&lt;P&gt;Sorry! Think I might of explained it poorly. The "New" and "In Progress" are in a field named ticket_state while the short_description field holds values that describe the ticket, such as "Linux VM keeps crashing" for example. &lt;/P&gt;

&lt;P&gt;Disregarding that, I still dont get the values I expect. I picked a ticket at random to try and trouble shoot. It had 3 states, New , In Progress and Complete.  I wanted to test to see if it worked by using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats earliest(ticket_state) as old_state latest(ticket_state) as new_state BY number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously the earliest should be New and the latest should be Complete, but im getting both being set to Complete. &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:21:43 GMT</pubDate>
    <dc:creator>Moreilly97</dc:creator>
    <dc:date>2020-09-29T18:21:43Z</dc:date>
    <item>
      <title>Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336129#M99796</link>
      <description>&lt;P&gt;So I have events that are tickets that have a State eg. "New" , "In Progress"  , "Completed" etc and a short_description field with its value being a descriptor, as well as a unique number to differentiate between the tickets such as NO232 . &lt;/P&gt;

&lt;P&gt;What Im trying to do is iterate through all the tickets and find out when short description changes from one value to another and in which state it was in. &lt;/P&gt;

&lt;P&gt;I currently use streamstats which I believed worked well until I realised that it wasn't doing what I thought it was doing. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| base search getting the tickets I want to focus on ...
| streamstats current=true last(short_description) AS old_description, first(short_description) AS new_description BY number
| search old_description!="*#*" AND new_description ="*#*"))
| sorting and adding results to table...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I expected this to do was search the last event of the ticket, which was when its state was New, and see if its description did not include a # , and then check to see if the tickets description was updated anywhere in the lifespan to include a #.&lt;/P&gt;

&lt;P&gt;What I believe it is doing is just comparing the latest state and the previous state, for example comparing Closed and In Progress instead of New -&amp;gt; Closed.&lt;/P&gt;

&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 16:10:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336129#M99796</guid>
      <dc:creator>Moreilly97</dc:creator>
      <dc:date>2018-03-08T16:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336130#M99797</link>
      <description>&lt;P&gt;Hey Moreilly97,&lt;/P&gt;

&lt;P&gt;I am not sure if this will work but you can try this:&lt;BR /&gt;
| stats values(state) AS state values(short_description) AS description by number,_time | eval status=case(description="&lt;EM&gt;#&lt;/EM&gt;" AND state="NEW","updated",description!="&lt;EM&gt;#&lt;/EM&gt;" AND state="NEW","NotUpdated") | stats values(status) AS status dc(status) AS count by number | search count&amp;gt;1  &lt;/P&gt;

&lt;P&gt;This should give you the numbers that were updated.&lt;BR /&gt;
Let me know if this helps!!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:21:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336130#M99797</guid>
      <dc:creator>deepashri_123</dc:creator>
      <dc:date>2020-09-29T18:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336131#M99798</link>
      <description>&lt;P&gt;Given your goal, I think you will get what you're looking for if you replace this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats current=true last(short_description) AS old_description, first(short_description) AS new_description BY number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats earliest(short_description) AS old_description latest(short_description) AS new_description BY number
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Mar 2018 17:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336131#M99798</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-08T17:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336132#M99799</link>
      <description>&lt;P&gt;Unfortunately I still get similar results. It is not comparing the tickets first event with the latest event.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 11:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336132#M99799</guid>
      <dc:creator>Moreilly97</dc:creator>
      <dc:date>2018-03-09T11:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336133#M99800</link>
      <description>&lt;P&gt;Ok, let's back up a little bit. I assume it's always true that a ticket starts in a state with &lt;CODE&gt;short_description="New"&lt;/CODE&gt;, moves next into &lt;CODE&gt;short_description="In Progress"&lt;/CODE&gt;, and concludes with &lt;CODE&gt;short_description="Complete"&lt;/CODE&gt;. If that's true, then this code snippet:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats earliest(short_description) AS old_description latest(short_description) AS new_description BY number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should result in each ticket getting a new field called &lt;CODE&gt;old_description="New"&lt;/CODE&gt;, because that would always be the earliest state that a ticket was in. Tickets that past the state of being new would either wind up with &lt;CODE&gt;new_description="In Progress"&lt;/CODE&gt; (if the ticket never got completed) or &lt;CODE&gt;new_description="Complete"&lt;/CODE&gt; (if the ticket did get completed). &lt;/P&gt;

&lt;P&gt;So how about identifying two tickets in your records - one that did get completed, and one that never reached completion, and running a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;whatever search finds all events involving those two tickets
| eventstats earliest(short_description) AS old_description latest(short_description) AS new_description BY number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you wind up with the expected values for &lt;CODE&gt;old_description&lt;/CODE&gt; and &lt;CODE&gt;new_description&lt;/CODE&gt;? &lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 13:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336133#M99800</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-09T13:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336134#M99801</link>
      <description>&lt;P&gt;Sorry! Think I might of explained it poorly. The "New" and "In Progress" are in a field named ticket_state while the short_description field holds values that describe the ticket, such as "Linux VM keeps crashing" for example. &lt;/P&gt;

&lt;P&gt;Disregarding that, I still dont get the values I expect. I picked a ticket at random to try and trouble shoot. It had 3 states, New , In Progress and Complete.  I wanted to test to see if it worked by using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats earliest(ticket_state) as old_state latest(ticket_state) as new_state BY number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously the earliest should be New and the latest should be Complete, but im getting both being set to Complete. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336134#M99801</guid>
      <dc:creator>Moreilly97</dc:creator>
      <dc:date>2020-09-29T18:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336135#M99802</link>
      <description>&lt;P&gt;Well, that's quite odd. Any chance you can post a screencap (with any sensitive data covered up) or copy/paste the events and full query (again, redacted as needed) so I can see if there's anything I can spot?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 14:05:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336135#M99802</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-09T14:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336136#M99803</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/73198"&gt;@elliotproebstel&lt;/a&gt; Hi Elliot, sorry for the late reply, I got your suggestion to work (problem on my end).&lt;/P&gt;

&lt;P&gt;However, Im still not getting what Im expecting. I handpicked a few tickets to check the results.&lt;BR /&gt;
These tickets had the old_description==new_description , however, If I investigate it the earliest state i.e when the the ticket was "New" the description is not equal to the new description.&lt;/P&gt;

&lt;P&gt;For example : &lt;A href="https://prnt.sc/iq1v78" target="_blank"&gt;https://prnt.sc/iq1v78&lt;/A&gt;  This is a picture of the results which state that the earliest description matches the latest description. However, if I dig down I find the following  &lt;A href="https://prnt.sc/iq1v28" target="_blank"&gt;https://prnt.sc/iq1v28&lt;/A&gt;    Which shows that the earliest description doesnt match at all.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:24:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336136#M99803</guid>
      <dc:creator>Moreilly97</dc:creator>
      <dc:date>2020-09-29T18:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing previous event field value to another event field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336137#M99804</link>
      <description>&lt;P&gt;I want to help, but the screencaps are so limited in what they're displaying that I don't have much to work with here. Can you include the queries and the field headers? Or some sanitized version of the same? I just don't know what I'm seeing in those screencaps, sorry.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 01:14:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-previous-event-field-value-to-another-event-field/m-p/336137#M99804</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-13T01:14:49Z</dc:date>
    </item>
  </channel>
</rss>

