<?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 Search query result from two log statements. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469376#M132088</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I wanted to search result as count from two log statements.&lt;BR /&gt;
one log statement has value "...Out of stock ..." &lt;BR /&gt;
and another log statement has "DF Suppressed"&lt;BR /&gt;
I wanted to get count of these two for transaction for past 10 days. Each log statement prints with a transactionId.&lt;/P&gt;

&lt;P&gt;This is the one I have for only one item&lt;BR /&gt;
index=idp_* "DF Suppressed" | dedup x_TraceId | stats count as DF_Supress_count | where DF_Supress_count&amp;gt;0&lt;/P&gt;

&lt;P&gt;But I want to include "Out of stock" to the query&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 02:45:00 GMT</pubDate>
    <dc:creator>mahenderj</dc:creator>
    <dc:date>2020-09-30T02:45:00Z</dc:date>
    <item>
      <title>Search query result from two log statements.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469376#M132088</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I wanted to search result as count from two log statements.&lt;BR /&gt;
one log statement has value "...Out of stock ..." &lt;BR /&gt;
and another log statement has "DF Suppressed"&lt;BR /&gt;
I wanted to get count of these two for transaction for past 10 days. Each log statement prints with a transactionId.&lt;/P&gt;

&lt;P&gt;This is the one I have for only one item&lt;BR /&gt;
index=idp_* "DF Suppressed" | dedup x_TraceId | stats count as DF_Supress_count | where DF_Supress_count&amp;gt;0&lt;/P&gt;

&lt;P&gt;But I want to include "Out of stock" to the query&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469376#M132088</guid>
      <dc:creator>mahenderj</dc:creator>
      <dc:date>2020-09-30T02:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search query result from two log statements.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469377#M132089</link>
      <description>&lt;P&gt;Maybe something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idp_* ("DF Suppressed" OR "Out of stock") transactionId=*
| rex field=_raw ".+(?&amp;lt;dfsuppressed&amp;gt;DF Suppressed)"
| rex field=_raw ".+(?&amp;lt;outofstock&amp;gt;Out of stock)"
| stats count(outofstock) as oosCount count(dfsuppressed) as dfsCount by transactionId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Add additional filtering later - for example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where dfsCount&amp;gt;0 AND oosCount&amp;gt;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...or whatever else you might like.&lt;/P&gt;

&lt;P&gt;This will create two new fields - &lt;CODE&gt;dfsuppressed&lt;/CODE&gt; and &lt;CODE&gt;outofstock&lt;/CODE&gt; - which will either have the text you're looking for in them, or be null.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 22:14:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469377#M132089</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2019-10-24T22:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Search query result from two log statements.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469378#M132090</link>
      <description>&lt;P&gt;Thanks for your answer. &lt;BR /&gt;
Your search criteria ran without any errors but I see only Out of Stock(oosCount )  counts and 0 count for dfsCount.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 03:47:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469378#M132090</guid>
      <dc:creator>mahenderj</dc:creator>
      <dc:date>2019-10-25T03:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search query result from two log statements.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469379#M132091</link>
      <description>&lt;P&gt;Add a &lt;CODE&gt;|fillnull&lt;/CODE&gt; between the second &lt;CODE&gt;| rex&lt;/CODE&gt; line and the &lt;CODE&gt;| stats&lt;/CODE&gt; thusly:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idp_* ("DF Suppressed" OR "Out of stock") transactionId=*
| rex field=_raw ".+(?&amp;lt;dfsuppressed&amp;gt;DF Suppressed)"
| rex field=_raw ".+(?&amp;lt;outofstock&amp;gt;Out of stock)"
| fillnull
| stats count(outofstock) as oosCount count(dfsuppressed) as dfsCount by transactionId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may have events where one or the other of the &lt;CODE&gt;rex&lt;/CODE&gt; lines isn't pulling an actual value, so it's getting null. Adding a &lt;CODE&gt;| fillnull&lt;/CODE&gt; will put the value of &lt;CODE&gt;0&lt;/CODE&gt; in any otherwise-null fields.&lt;/P&gt;

&lt;P&gt;Also, make sure that the &lt;EM&gt;exact&lt;/EM&gt; text is correct on the &lt;CODE&gt;rex&lt;/CODE&gt; lines (eg &lt;CODE&gt;"Out of stock"&lt;/CODE&gt; vs &lt;CODE&gt;"Out Of Stock"&lt;/CODE&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 21:52:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-result-from-two-log-statements/m-p/469379#M132091</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2019-10-30T21:52:15Z</dc:date>
    </item>
  </channel>
</rss>

