<?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 do line by line compare and show if there is a difference? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615291#M14071</link>
    <description>&lt;P&gt;Here's one approach you can take:&lt;/P&gt;&lt;P&gt;1. Calculate the most common ios value "common_ios" for each host (using appendpipe and top)&lt;BR /&gt;2. Populate the common_ios value to each event using eventstats&lt;BR /&gt;3. Look for any ios value that's different than the&amp;nbsp;common_ios value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval events="2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU5 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU4 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU3 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU2 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU1 IOS: 76;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU0 IOS: 96"
| eval events=SPLIT(events, ";"), host="ACME_SERVER1"
| mvexpand events
| rex field=events "^.*\]:\s(?&amp;lt;gpu&amp;gt;GPU\d+)\sIOS\:\s+(?&amp;lt;ios&amp;gt;\d+)"
| eval gpu_ios=gpu." : ".ios
| bucket _time span=1m
| appendpipe [| top 1 ios BY _time host | rename ios AS common_ios | table _time common_ios host]
| eventstats max(common_ios) AS common_ios values(gpu_ios) AS gpu_ios BY _time host
| where LEN(gpu)&amp;gt;1 AND ios!=common_ios
| table _time host gpu ios common_ios gpu_ios&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2022 05:06:24 GMT</pubDate>
    <dc:creator>johnhuang</dc:creator>
    <dc:date>2022-09-30T05:06:24Z</dc:date>
    <item>
      <title>How to do line by line compare and show if there is a difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615287#M14070</link>
      <description>&lt;P&gt;I have the following sample event&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;2022-09-29T19:29:22.260916-07:00&lt;/SPAN&gt;&amp;nbsp;abc&amp;nbsp;&lt;SPAN class=""&gt;log-inventory.sh&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;24349&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;GPU5&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;IOS:&lt;/SPAN&gt; &lt;SPAN class=""&gt;96&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh&lt;SPAN&gt;[&lt;/SPAN&gt;24349&lt;SPAN&gt;]&lt;/SPAN&gt;: GPU4&amp;nbsp;IOS: 96&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-09-29T19:29:22.260916-07:00&amp;nbsp;abc log-inventory.sh&lt;SPAN&gt;[&lt;/SPAN&gt;24349&lt;SPAN&gt;]&lt;/SPAN&gt;: GPU3&amp;nbsp;IOS: 96&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh&lt;SPAN&gt;[&lt;/SPAN&gt;24349&lt;SPAN&gt;]&lt;/SPAN&gt;: GPU2&amp;nbsp;IOS: 96&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh&lt;SPAN&gt;[&lt;/SPAN&gt;24349&lt;SPAN&gt;]&lt;/SPAN&gt;: GPU1&amp;nbsp;IOS:&amp;nbsp;76&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh&lt;SPAN&gt;[&lt;/SPAN&gt;24349&lt;SPAN&gt;]&lt;/SPAN&gt;: GPU0&amp;nbsp;IOS: 96&lt;BR /&gt;&lt;BR /&gt;I want to compare the IOS value&amp;nbsp; for each host and if any one is showing a different value then I want to output the result .In the above events for host=abc all GPU's has IOS value as 96 except for GPU1 which is 76.I want to output the GPU1 and the value of IOS...I tried doing diff but its not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks in Advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 03:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615287#M14070</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-09-30T03:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to do line by line compare and show if there is a difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615291#M14071</link>
      <description>&lt;P&gt;Here's one approach you can take:&lt;/P&gt;&lt;P&gt;1. Calculate the most common ios value "common_ios" for each host (using appendpipe and top)&lt;BR /&gt;2. Populate the common_ios value to each event using eventstats&lt;BR /&gt;3. Look for any ios value that's different than the&amp;nbsp;common_ios value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval events="2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU5 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU4 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU3 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU2 IOS: 96;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU1 IOS: 76;2022-09-29T19:29:22.260916-07:00 abc log-inventory.sh[24349]: GPU0 IOS: 96"
| eval events=SPLIT(events, ";"), host="ACME_SERVER1"
| mvexpand events
| rex field=events "^.*\]:\s(?&amp;lt;gpu&amp;gt;GPU\d+)\sIOS\:\s+(?&amp;lt;ios&amp;gt;\d+)"
| eval gpu_ios=gpu." : ".ios
| bucket _time span=1m
| appendpipe [| top 1 ios BY _time host | rename ios AS common_ios | table _time common_ios host]
| eventstats max(common_ios) AS common_ios values(gpu_ios) AS gpu_ios BY _time host
| where LEN(gpu)&amp;gt;1 AND ios!=common_ios
| table _time host gpu ios common_ios gpu_ios&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 05:06:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615291#M14071</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-09-30T05:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to do line by line compare and show if there is a difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615420#M14087</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&amp;nbsp; Thank you for you reply.How do I make it work to only look at the latest events for a host(GPU0-GPU5) .Currently it is showing all the results when there is a change but I only want to see the latest and if there is change show only that.&lt;BR /&gt;&lt;BR /&gt;Below is the query I used&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=preos_inventory sourcetype = preos_inventory host IN(*) 
| rex field=_raw "log-inventory.sh\[(?&amp;lt;id&amp;gt;[^\]]+)\]\:\s*(?&amp;lt;gpu&amp;gt;[^\:]+)\:\s*(?&amp;lt;ios&amp;gt;.*)" 
| search gpu=*VBIOS* host=preos 
| eval gpu_ios=gpu." : ".ios
| bucket _time span=1m
| appendpipe [| top 1 ios BY _time host | rename ios AS common_ios | table _time common_ios host]
| eventstats max(common_ios) AS common_ios values(gpu_ios) AS gpu_ios BY _time host

| table _time host gpu ios common_ios gpu_ios 
| where LEN(gpu)&amp;gt;1  AND ios!=common_ios&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 30 Sep 2022 16:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615420#M14087</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-09-30T16:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to do line by line compare and show if there is a difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615435#M14089</link>
      <description>&lt;P&gt;Use latest.&lt;/P&gt;&lt;P&gt;index=preos_inventory sourcetype = preos_inventory host IN(*)&lt;BR /&gt;| rex field=_raw "log-inventory.sh\[(?&amp;lt;id&amp;gt;[^\]]+)\]\:\s*(?&amp;lt;gpu&amp;gt;[^\:]+)\:\s*(?&amp;lt;ios&amp;gt;.*)"&lt;BR /&gt;| search gpu=*VBIOS* host=preos&lt;BR /&gt;| eval gpu_ios=gpu." : ".ios&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;| stats latest(_time) AS _time latest(*) AS * BY host gpu&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;| bucket _time span=1m&lt;BR /&gt;| appendpipe [| top 1 ios BY _time host | rename ios AS common_ios | table _time common_ios host]&lt;BR /&gt;| eventstats max(common_ios) AS common_ios values(gpu_ios) AS gpu_ios BY _time host&lt;BR /&gt;| table _time host gpu ios common_ios gpu_ios&lt;BR /&gt;| where LEN(gpu)&amp;gt;1 AND ios!=common_ios&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 17:05:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615435#M14089</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-09-30T17:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to do line by line compare and show if there is a difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615900#M14107</link>
      <description>&lt;P&gt;Thank you this worked&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 21:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-do-line-by-line-compare-and-show-if-there-is-a-difference/m-p/615900#M14107</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2022-10-04T21:00:01Z</dc:date>
    </item>
  </channel>
</rss>

