<?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: Combining two search stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94308#M24296</link>
    <description>&lt;P&gt;sorry i meant ratio of SuccessCases/FailureCases&lt;/P&gt;</description>
    <pubDate>Wed, 19 Oct 2011 13:13:23 GMT</pubDate>
    <dc:creator>adityapavan18</dc:creator>
    <dc:date>2011-10-19T13:13:23Z</dc:date>
    <item>
      <title>Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94306#M24294</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have 2 search queries.&lt;/P&gt;

&lt;P&gt;sourcetype="zzz" Accepted | stats count as SuccessCases&lt;/P&gt;

&lt;P&gt;sourcetype="zzz" Rejected | stats count as FailureCases&lt;/P&gt;

&lt;P&gt;Now i need to find the rqtion of both.How ca i do that.Can anyone help me here&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 11:28:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94306#M24294</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2011-10-19T11:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94307#M24295</link>
      <description>&lt;P&gt;"rqtion" ?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 12:07:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94307#M24295</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-10-19T12:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94308#M24296</link>
      <description>&lt;P&gt;sorry i meant ratio of SuccessCases/FailureCases&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 13:13:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94308#M24296</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2011-10-19T13:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94309#M24297</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;If &lt;CODE&gt;Accepted&lt;/CODE&gt; and &lt;CODE&gt;Rejected&lt;/CODE&gt; are extracted into a field, e.g. &lt;CODE&gt;zzz_status&lt;/CODE&gt; or something similar, the following search might do the trick.&lt;/P&gt;

&lt;P&gt;UPDATED AGAIN AGAIN: If you just want to count the occurence of success/fail, and the events within the log contain the string mentioned in your comment ( &lt;CODE&gt;&amp;lt;ns:emailaccepted blah&amp;gt;&lt;/CODE&gt; or &lt;CODE&gt;&amp;lt;ns:emailrejected blah blah&amp;gt;&lt;/CODE&gt; ), the search could be altered into;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="zzz" | rex field=_raw "&amp;lt;ns:email(?&amp;lt;zzz_status&amp;gt;[^ ]+)| stats count(eval(zzz_status=="accepted")) AS Success count(eval(zzz_status=="rejected")) AS Fail | eval SuccessRatio=Success/Fail | table Success, Fail, SuccessToFailRatio
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;rex&lt;/CODE&gt; statement above will find whatever is between "&lt;CODE&gt;&amp;lt;ns:email&lt;/CODE&gt;" and the first blank space (" "), and call it &lt;CODE&gt;zzz_status&lt;/CODE&gt;. Beware though that this would also match on &lt;CODE&gt;&amp;lt;ns:email-server&lt;/CODE&gt;, &lt;CODE&gt;&amp;lt;ns:emailaccount&lt;/CODE&gt;,  &lt;CODE&gt;&amp;lt;ns:emailAddress&lt;/CODE&gt; etc etc, so you might want to watch your step there...&lt;/P&gt;

&lt;P&gt;hth,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 13:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94309#M24297</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2011-10-19T13:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94310#M24298</link>
      <description>&lt;P&gt;Thanks Kristian.&lt;/P&gt;

&lt;P&gt;But now i am stuck with one other problem, when i said Accepted (it is a part of XML tag), can you help how to extract XML tag name&lt;/P&gt;

&lt;P&gt;Like my xml's having tags *Accepted  are success scenario logs [eg: &lt;EMAILACCEPTED&gt;  or &lt;EMAILREJECTED&gt; ]&lt;/EMAILREJECTED&gt;&lt;/EMAILACCEPTED&gt;&lt;/P&gt;

&lt;P&gt;so i need to count all events with EmailAccepted in XML's&lt;/P&gt;

&lt;P&gt;and then take a ratio&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 13:53:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94310#M24298</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2011-10-19T13:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94311#M24299</link>
      <description>&lt;P&gt;Could you submit a sample event or two. I believe that rex is the answer to your question.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 15:14:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94311#M24299</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2011-10-19T15:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94312#M24300</link>
      <description>&lt;P&gt;&lt;DATA&gt;text&lt;/DATA&gt;&lt;TEXT&gt;Message sent: &lt;EMAILACCEPTED SOMEXMLNS=""&gt;&lt;BR /&gt;
  &lt;A href="ns:Response"&gt;ns:Response&lt;/A&gt;&lt;BR /&gt;
  &lt;A href="ns:RID"&gt;ns:RID&lt;/A&gt;1234&lt;A href="https://answers.splunk.comns:RID"&gt;/ns:RID&lt;/A&gt;&lt;BR /&gt;
    &lt;A href="ns:RQID"&gt;ns:RQID&lt;/A&gt;D201109191&lt;A href="https://answers.splunk.comns:RQID"&gt;/ns:RQID&lt;/A&gt;&lt;/EMAILACCEPTED&gt;&lt;/TEXT&gt;&lt;/P&gt;

&lt;P&gt;same way &lt;/P&gt;

&lt;P&gt;&lt;DATA&gt;text&lt;/DATA&gt;&lt;TEXT&gt;Message sent : &lt;EMAILREJECTED SOMEXMLNS=""&gt;&lt;BR /&gt;
  &lt;A href="ns:Response"&gt;ns:Response&lt;/A&gt;&lt;BR /&gt;
  &lt;A href="ns:RID"&gt;ns:RID&lt;/A&gt;1234&lt;A href="https://answers.splunk.comns:RID"&gt;/ns:RID&lt;/A&gt;&lt;BR /&gt;
    &lt;A href="ns:RQID"&gt;ns:RQID&lt;/A&gt;D201109191&lt;A href="https://answers.splunk.comns:RQID"&gt;/ns:RQID&lt;/A&gt;&lt;/EMAILREJECTED&gt;&lt;/TEXT&gt;&lt;/P&gt;

&lt;P&gt;the logging happens where the actual payload starting with &amp;lt;ns:EmailAccepted but that is enclosed under TEXT&lt;/P&gt;

&lt;P&gt;success scenarios have EmailAccepted&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 16:23:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94312#M24300</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2011-10-19T16:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94313#M24301</link>
      <description>&lt;P&gt;you can use the xmlkv command to extract those key pairs.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2011 17:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-two-search-stats/m-p/94313#M24301</guid>
      <dc:creator>RicoSuave</dc:creator>
      <dc:date>2011-10-19T17:13:10Z</dc:date>
    </item>
  </channel>
</rss>

