<?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 search count of multiple logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627259#M217968</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Please share some of your events (in a code block using the &amp;lt;/&amp;gt; formatting button), anonymised of course.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2023 15:13:11 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-01-16T15:13:11Z</dc:date>
    <item>
      <title>How to search count of multiple logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627248#M217960</link>
      <description>&lt;P&gt;How can I write a query like following?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=my_app&lt;BR /&gt;| eval userError="Error while fetching User"&lt;BR /&gt;| eval addressError = "Did not find address of user"&lt;BR /&gt;| stats count(userError) as totalUserErrors, count(addressError) as totalAddressErrors&lt;BR /&gt;&lt;BR /&gt;Expected output:&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Error while fetching User&lt;/TD&gt;
&lt;TD width="50%"&gt;50&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Did not find address of user&lt;/TD&gt;
&lt;TD width="50%"&gt;30&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 19:29:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627248#M217960</guid>
      <dc:creator>vishal_pcap</dc:creator>
      <dc:date>2023-01-17T19:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627249#M217961</link>
      <description>&lt;P&gt;Is this what you are trying to do?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_app
| stats count(eval(userError=="Error while fetching User")) as totalUserErrors, count(eval(addressError=="Did not find address of user")) as totalAddressErrors&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 14:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627249#M217961</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-16T14:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627251#M217962</link>
      <description>&lt;P&gt;The query doesn't return anything &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; I wanted to have a tabular output - error message and number of times it appeared&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 14:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627251#M217962</guid>
      <dc:creator>vishal_pcap</dc:creator>
      <dc:date>2023-01-16T14:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627252#M217963</link>
      <description>&lt;P&gt;Please share some of your events (in a code block using the &amp;lt;/&amp;gt; formatting button), anonymised of course.&lt;/P&gt;&lt;P&gt;Also, share your current search, so we can see what you have tried so far..&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 14:26:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627252#M217963</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-16T14:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627255#M217965</link>
      <description>&lt;P&gt;So when I search the following query in splunk, it returns 50k+ records&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xxxeks_prod_app cluster_name="xxxx-xxxxx-prod-eks-cluster-v1" container_name="xx*-service" "Error while fetching Users"&lt;/LI-CODE&gt;&lt;P&gt;and I want to see the multiple error logs and their count (for the duration I have selected e.g. 30 minutes)&lt;BR /&gt;Here's what I have tried but it returned 0 count&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xxxeks_prod_app cluster_name="xxxx-xxxxx-prod-eks-cluster-v1" container_name="xx*-service" | stats count(eval(userError=="Error while fetching Users")) as totalUserErrors&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 14:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627255#M217965</guid>
      <dc:creator>vishal_pcap</dc:creator>
      <dc:date>2023-01-16T14:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627257#M217966</link>
      <description>&lt;P&gt;It looks like the errorError field has not been extracted.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 15:03:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627257#M217966</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-16T15:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627258#M217967</link>
      <description>&lt;P&gt;How to extract that?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 15:10:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627258#M217967</guid>
      <dc:creator>vishal_pcap</dc:creator>
      <dc:date>2023-01-16T15:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627259#M217968</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Please share some of your events (in a code block using the &amp;lt;/&amp;gt; formatting button), anonymised of course.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 15:13:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627259#M217968</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-16T15:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627263#M217970</link>
      <description>&lt;P&gt;oh yes,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;1/16/23
7:15:44.624 AM	
2023-01-16 07:15:44 AM [http-nio-8080-exec-8] [trace_id:  / span_id: ] ERROR jobTraceId= commandTraceId=   {X-B3-ParentSpanId=xxxxxx, X-B3-SpanId=xxxxx, X-B3-TraceId=xxxxx, X-Span-Export=false, parentId=xxxxx, spanExportable=false, spanId=xxxx, traceId=xxxxxxxxxxxx} com.demo.controller.UserController - Error while fetching Users participant and plan info details=Could not find any User for the userId=202961636 java.lang.IllegalArgumentException: Could not find any User for userId=202961636
	at com.demo.service.UserServiceV2.lambda$prepareUserInfo$4(UserServiceV2.java:520) ~[demo-data-rest-1.0.22.12.40.jar:?]
	at java.util.Optional.orElseThrow(Unknown Source) ~[?:?]
	at com.demo.service.UserServiceV2.prepareUserInfo(UserServiceV2.java:520) ~[demo-data-rest-1.0.22.12.40.jar:?]

host = ip-11-000-00-00.us-west-2.compute.internalsource = /var/log/containers/demo-v2-service-55f87cc4v2-v2service-78f8e0f8ff9689627faa4718f34578bd511913596cbf57.logsourcetype = kube:container:demo-v2-service&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;2023-01-16 07:21:28 AM [http-nio-8080-exec-63] [trace_id:  / span_id: ] ERROR com.demo.service.PersonApiChunkService - Error while handling user: bae9877cf5ab433xx39fda32ffd9833exx6bf2 com.demo.exception.ResourceNotFoundException: No User address Found for personId=329813370 deviceId=7440501_P_192

host = ip-11-000-00-00.us-west-2.compute.internalsource = /var/log/containers/demo-v2-service-55f87cc4v2-v2service-78f8e0f8ff9689627faa4718f34578bd511913596cbf57.logsourcetype = kube:container:demo-v2-service&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 15:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627263#M217970</guid>
      <dc:creator>vishal_pcap</dc:creator>
      <dc:date>2023-01-16T15:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627268#M217974</link>
      <description>&lt;P&gt;Given that your event don't appear to have any structured fields, you could try counting matches of the _raw field&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count(eval(match(_raw,"Error while fetching Users"))) as userError count(eval(match(_raw,"No User address Found"))) as addressError&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 15:54:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627268#M217974</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-16T15:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to search count of multiple logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627272#M217978</link>
      <description>&lt;P&gt;This works! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you very much,&amp;nbsp; I have also figured out one more way to do this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval errorType=case(
   match(_raw, "Error while fetching Users"), "Error while fetching Users",
   match(_raw, "No User address Found"), "No User address Found"
) | stats count by errorType | table errorType, count&lt;/LI-CODE&gt;&lt;P&gt;This gives me the table structure I wanted, the error message and count.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 16:09:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-count-of-multiple-logs/m-p/627272#M217978</guid>
      <dc:creator>vishal_pcap</dc:creator>
      <dc:date>2023-01-16T16:09:40Z</dc:date>
    </item>
  </channel>
</rss>

