<?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: How to compare events using two values of a multi-value field. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549852#M156052</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;This won't work for 2 reasons. First, it will only list out the started jobs again, i.e.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Job A&lt;BR /&gt;Job B&lt;BR /&gt;Job C&lt;/P&gt;&lt;P&gt;Secondly, as I said, JOB_STATUS is a multi-value field thus, it also contains some other unnecessary values. Which causes JOB_STATUS!=stopped to list again ONLY the started jobs and also job events for the other status values.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Apr 2021 14:30:59 GMT</pubDate>
    <dc:creator>parthmadane</dc:creator>
    <dc:date>2021-04-29T14:30:59Z</dc:date>
    <item>
      <title>How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549848#M156049</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been struggling for a while now to create a query for comparing the events using two different values of a multi-value field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For starter -&lt;/P&gt;&lt;P&gt;We have certain jobs running for which their status is to be monitored. Below is an example of query/data -&lt;/P&gt;&lt;P&gt;Query - source=src_name sourcetype=application Job_Name=*&amp;nbsp; JOB_STATUS=started&lt;/P&gt;&lt;P&gt;Output -&lt;/P&gt;&lt;P&gt;Job A&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Job B&lt;/P&gt;&lt;P&gt;Job C&lt;/P&gt;&lt;P&gt;Query - source=src_name sourcetype=application Job_Name=*&amp;nbsp; JOB_STATUS=stopped&lt;/P&gt;&lt;P&gt;Output -&lt;/P&gt;&lt;P&gt;Job A&lt;/P&gt;&lt;P&gt;Job C&lt;/P&gt;&lt;P&gt;JOB_STATUS is the multi-value field that gives the respective Job's status after it starts running i.e. "Started." If the Job run is successful then it will be stopped, thus, there will be an event for that JOB with status as "Stopped".&lt;/P&gt;&lt;P&gt;Else, the Job will remain in started state and so, there'll only be a "Started" event present for that JOB.&lt;/P&gt;&lt;P&gt;What I need help with?&lt;/P&gt;&lt;P&gt;I need a query that can compare and give the list of those Jobs that are only started and not stopped yet.&lt;/P&gt;&lt;P&gt;Example Query -&amp;nbsp;&lt;/P&gt;&lt;P&gt;source=src_name sourcetype=application {-- query Return jobs that are only in started and not stopped yet --}&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;Required Output -&lt;/DIV&gt;&lt;DIV&gt;Job B&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Please help out!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:06:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549848#M156049</guid>
      <dc:creator>parthmadane</dc:creator>
      <dc:date>2021-04-29T14:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549851#M156051</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source=src_name sourcetype=application JOB_STATUS=started JOB_STATUS!=stopped&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:24:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549851#M156051</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-29T14:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549852#M156052</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;This won't work for 2 reasons. First, it will only list out the started jobs again, i.e.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Job A&lt;BR /&gt;Job B&lt;BR /&gt;Job C&lt;/P&gt;&lt;P&gt;Secondly, as I said, JOB_STATUS is a multi-value field thus, it also contains some other unnecessary values. Which causes JOB_STATUS!=stopped to list again ONLY the started jobs and also job events for the other status values.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549852#M156052</guid>
      <dc:creator>parthmadane</dc:creator>
      <dc:date>2021-04-29T14:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549853#M156053</link>
      <description>&lt;P&gt;Here is a run-anywhere example with additional status values in the multi-value field showing that only job B is returned&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval event="A,started;running;other unnecessary value;stopped:B,started;running;other unnecessary value:C,started;running;other unnecessary value;stopped"
| eval event=split(event,":")
| mvexpand event
| eval job=mvindex(split(event,","),0)
| eval status=split(mvindex(split(event,","),1),";")
| fields job status
| fields - _time
| search status!=stopped status=started&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:36:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549853#M156053</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-29T14:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549992#M156075</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I think the information provided by me earlier, was a bit ambiguous. Basically, there is one event each generated w.r.t the JOB. For e.g. when it starts, then runs, some other values, stops. When the events are of such nature, the given solution does not work.&lt;/P&gt;&lt;P&gt;I have made some changes to your sample events to better replicate mine.&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval event="A,started:A,running:A,other unnecessary value:A,stopped:B,started:B,running:B,other unnecessary value:C,started:C,running:C,other unnecessary value:C,stopped"&lt;BR /&gt;| eval event=split(event,":")&lt;BR /&gt;| mvexpand event&lt;BR /&gt;| eval job=mvindex(split(event,","),0)&lt;BR /&gt;| eval status=split(mvindex(split(event,","),1),";")&lt;BR /&gt;| fields job status&lt;BR /&gt;| fields - _time&lt;BR /&gt;| search status!=stopped status=started&lt;/P&gt;&lt;P&gt;You will notice that both the&amp;nbsp;status!=stopped status=started and&amp;nbsp;status=started are returning the same result in this (my) scenario.&lt;/P&gt;&lt;P&gt;Is there any way to compare the events and only return those jobs that are only in started and have not stopped yet. Your help in this regard is appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 12:20:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549992#M156075</guid>
      <dc:creator>parthmadane</dc:creator>
      <dc:date>2021-04-30T12:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549994#M156077</link>
      <description>&lt;P&gt;You can gather the information on the job together so the status is a multi-value field, then the search will work&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval event="A,started:A,running:A,other unnecessary value:A,stopped:B,started:B,running:B,other unnecessary value:C,started:C,running:C,other unnecessary value:C,stopped"
| eval event=split(event,":")
| mvexpand event
| eval job=mvindex(split(event,","),0)
| eval status=split(mvindex(split(event,","),1),";")
| fields job status
| fields - _time
| stats values(status) as status by job
| search status!=stopped status=started&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 30 Apr 2021 12:26:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549994#M156077</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-30T12:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare events using two values of a multi-value field.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549996#M156079</link>
      <description>&lt;P&gt;If you want to keep all the original data, use eventstats instead&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval event="A,started:A,running:A,other unnecessary value:A,stopped:B,started:B,running:B,other unnecessary value:C,started:C,running:C,other unnecessary value:C,stopped"
| eval event=split(event,":")
| mvexpand event
| eval job=mvindex(split(event,","),0)
| eval status=split(mvindex(split(event,","),1),";")
| fields job status
| fields - _time
| eventstats values(status) as allstatus by job
| search allstatus!=stopped allstatus=started&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 30 Apr 2021 12:29:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-events-using-two-values-of-a-multi-value-field/m-p/549996#M156079</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-30T12:29:10Z</dc:date>
    </item>
  </channel>
</rss>

