<?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 visualize percentage rate of matching event pairs that share a common key value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618458#M214956</link>
    <description>&lt;P&gt;Good recommendations for clarity of my question. I've edited my initial ask to include sample data and the actual field names being used.&lt;/P&gt;&lt;P&gt;The end result is essentially just a line chart that shows the average percentage rate over the timeframe being queried; nothing fancy. I plan on using a timechart command to address that.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 19:59:05 GMT</pubDate>
    <dc:creator>beetlegeuse</dc:creator>
    <dc:date>2022-10-26T19:59:05Z</dc:date>
    <item>
      <title>How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618445#M214948</link>
      <description>&lt;P&gt;I'm working on a query with the goal of determining the percentage rate of request/response event pairs that match by way of a common field value. The events share the same index, sourcetype and source; the field name, however, is different. The field in the request event is called "ID" while the field in the response event is called "InResponseTo".&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;NOTE:&lt;/STRONG&gt;&lt;/U&gt; The response event also contains a field called "ID" which should be ignored.&lt;/P&gt;&lt;P&gt;Here is a sample of each type of event (note that these two events share the matching value "_907b4184-e85c-41f2-9a32-c1c735f01510")...&lt;/P&gt;&lt;P&gt;Request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Oct 26 17:32:29 ServerX knick.knack [10/26/22, 17:32:20:292 EDT] 00018baf id=00000000 om.tivoli.am.fim.trustserver.sts.utilities.IDMappingExtUtils I traceString  INFO --saml20-access-policy-utilities.js - [axamf4EhUmaVjkwwd+akl10BbjbDS1vVg6YJhu2F2E8=]:[protocolContext.getAuthnRequest()] &amp;lt;samlp:AuthnRequest xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" AssertionConsumerServiceURL="https://xyz.com" Destination="https://foobar.com" ForceAuthn="true" ID="_907b4184-e85c-41f2-9a32-c1c735f01510"&amp;lt;/samlp:Response&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Response:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Oct 26 17:32:29 ServerX knick.knack [10/26/22, 17:32:20:455 EDT] 00018baf id=00000000 .am.fim.saml20.types.SAML20HTTPPostBrowserResponseWriterImpl 1 getStringMessage Request XML message: &amp;lt;samlp:Response xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Destination="https://dundermifflin.com" ID="FIMRSP_1635e05b-0184-1dc4-803d-f94b11a6d04e" InResponseTo="_907b4184-e85c-41f2-9a32-c1c735f01510"&amp;lt;/samlp:Response&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The development flow:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Look at all request and response events for a given timeframe.&lt;/LI&gt;&lt;LI&gt;Sometimes, duplicate events show up...so they would need to be deduplicated.&lt;/LI&gt;&lt;LI&gt;If the same value is found for both "ID" and "InResponseTo", that's considered a 100% success rate. Mark it as a match. The sample events provided above would be an example of this.&lt;/LI&gt;&lt;LI&gt;If the same value is not found (i.e., there's a request event but no matching response event), that's considered a 0% success rate. Mark it as a non-match.&lt;/LI&gt;&lt;LI&gt;Add up the number of matches and divide the sum by the total number of request events found. Multiply the quotient by 100 to determine the percentage rate.&lt;/LI&gt;&lt;LI&gt;The results will be visualized using a simple line chart (timechart) showing the average percentage rate over time.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm able to compare the overall number of requests against the overall number of responses (regardless of matching field values) to produce a percentage rate, as shown here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=zig sourcetype=zag samlp:AuthnRequest | timechart count as RequestCount | appendcols [ search index=zig sourcetype=zag samlp:Response | timechart count as ResponseCount ] 
|  eval ResponseRequestRatio = round(((ResponseCount/RequestCount) * 100),2)
|  table _time, RequestCount, ResponseCount, ResponseRequestRatio&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I modify this query to accommodate the additional rules? I'm guessing that some sort of count could be used to determine the percentage rate, with a "1" for matches and a "0" (zero) for non-matches.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 21:46:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618445#M214948</guid>
      <dc:creator>beetlegeuse</dc:creator>
      <dc:date>2022-10-26T21:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618456#M214954</link>
      <description>&lt;P&gt;To help understand this better, could you provide some sample data and rather than using foo/bar, provide&amp;nbsp; the fieldname and sample values?&lt;/P&gt;&lt;P&gt;If you can create a mockup of the end result, that would help as well.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 18:54:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618456#M214954</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-26T18:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618458#M214956</link>
      <description>&lt;P&gt;Good recommendations for clarity of my question. I've edited my initial ask to include sample data and the actual field names being used.&lt;/P&gt;&lt;P&gt;The end result is essentially just a line chart that shows the average percentage rate over the timeframe being queried; nothing fancy. I plan on using a timechart command to address that.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 19:59:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618458#M214956</guid>
      <dc:creator>beetlegeuse</dc:creator>
      <dc:date>2022-10-26T19:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618469#M214962</link>
      <description>&lt;P&gt;Example of one way this could be done:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=zig sourcetype=zag ("samlp:AuthnRequest" OR "samlp:Response")
| eval event_id=COALESCE(ID, InResponseTo)
| eval event_type=CASE(ISNOTNULL(ID), "request", ISNOTNULL(InResponseTo), "response")
| stats MIN(_time) AS _time DC(event_type) AS dc_event_type BY event_id
| eval event_type=CASE(dc_event_type=1, "failure_ct", dc_event_type=2, "success_ct")
| bucket _time span=1h
| chart count AS event_count by _time event_type
| addtotals fieldname="total_ct"
| eval success_ratio = ROUND(((success_ct/total_ct) * 100),2)
| eval failure_ratio = ROUND(((failure_ct/total_ct) * 100),2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 21:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618469#M214962</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-26T21:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618478#M214963</link>
      <description>&lt;P&gt;I just gave this a try, and found that the failure_ct and total_ct are the same, with a failure_ratio of 100.0.&lt;/P&gt;&lt;P&gt;After reviewing the event data again, I did notice that the "ID" field also appears in the response event (but should be ignored for this use case). I've updated the sample events in this question to reflect that. Is this throwing off your query?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 21:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618478#M214963</guid>
      <dc:creator>beetlegeuse</dc:creator>
      <dc:date>2022-10-26T21:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618481#M214965</link>
      <description>&lt;P&gt;Yep the logic assumes the ID is null for the response event. Try this instead:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval event_type=CASE(MATCH(_raw, "samlp:AuthnRequest"), "request", MATCH(_raw, "samlp:Response"), "response")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Oct 2022 21:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618481#M214965</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-26T21:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618488#M214967</link>
      <description>&lt;P&gt;Same result...100.0 failure ratio.&lt;/P&gt;&lt;P&gt;It looks like the coalesce statement is grabbing the ID value from the response event (instead of the InResponseTo value) and assigning it to a "response" event_type. I'm wondering if it's doing that since the ID value appears before the InResponseTo value in the event.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 22:18:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618488#M214967</guid>
      <dc:creator>beetlegeuse</dc:creator>
      <dc:date>2022-10-26T22:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618493#M214970</link>
      <description>&lt;P&gt;You can try reversing the order of the coalesce.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 22:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618493#M214970</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-26T22:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618497#M214973</link>
      <description>&lt;P&gt;Reversing the order appears to have resulted in the correct field value being aligned with the event_type.&lt;/P&gt;&lt;P&gt;I noticed that some of the values have a single quote on either side of the value; how would I remove those quotes?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 22:52:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618497#M214973</guid>
      <dc:creator>beetlegeuse</dc:creator>
      <dc:date>2022-10-26T22:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618498#M214974</link>
      <description>&lt;P&gt;One of these depending what you mean by single quote.&lt;/P&gt;&lt;P&gt;| rex field=&lt;FONT face="Menlo, Monaco, Consolas, Courier New, monospace" color="#3e3e3e"&gt;&lt;SPAN&gt;event_id mode=sed "s/\"//g"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Menlo, Monaco, Consolas, Courier New, monospace" color="#3e3e3e"&gt;&lt;SPAN&gt;| rex field=event_id mode=sed "s/\'//g"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 22:58:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618498#M214974</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-26T22:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualize percentage rate of matching event pairs that share a common key value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618523#M214982</link>
      <description>&lt;P&gt;Thank you so much! The additional recommendations for sed, reversal of the coalesce field order and the adjustment to the CASE MATCH statement that you provided, when applied to your original solution, has given me a working query that meets expectations.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 04:58:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-visualize-percentage-rate-of-matching-event-pairs-that/m-p/618523#M214982</guid>
      <dc:creator>beetlegeuse</dc:creator>
      <dc:date>2022-10-27T04:58:39Z</dc:date>
    </item>
  </channel>
</rss>

