<?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: Search numbers of messages received by application based on json message in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741752#M240683</link>
    <description>&lt;P&gt;Based on your example data, that would appear to work.&lt;/P&gt;&lt;P&gt;If you copy in this example search you can see your spath and stats command do indeed extract the correct data and give you a count of 1, so what is your problem? Are you saying this is not working for you?&lt;/P&gt;&lt;P&gt;If not, it would indicate your data is perhaps not as you have shown.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Mar 2025 04:17:52 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2025-03-14T04:17:52Z</dc:date>
    <item>
      <title>Search numbers of messages received by application based on json message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741749#M240682</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my first post . I have just started learning writing splunk query .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok so we have one application sitting in kubernates cluster . We are calling end point of application&amp;nbsp; and doing some activity . I am seeing in logs json which we sent while calling endpoint.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"header": {&lt;BR /&gt;"version": "1.0",&lt;BR /&gt;"sender": "ABC",&lt;BR /&gt;"publishDateTime": "2025-03-12T15:54:32Z"&lt;BR /&gt;},&lt;BR /&gt;"audit": {&lt;BR /&gt;"addDateTime": "2024-04-19 05:42:57",&lt;BR /&gt;"addBy": "PP"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find count of all request I have made where I am seeing messages&amp;nbsp; as addBy as PP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to use multiple things like spath search but not getting how to do .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kubernetes_cluster="abc*" index="aaaa" sourcetype = "kubernetes_logs" source = *pub-sub*&amp;nbsp; |spath output=myfiled path=audit.addBy&amp;nbsp;&amp;nbsp;&amp;nbsp; | stats count by&amp;nbsp;myfiled&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 03:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741749#M240682</guid>
      <dc:creator>Punnu</dc:creator>
      <dc:date>2025-03-14T03:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search numbers of messages received by application based on json message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741752#M240683</link>
      <description>&lt;P&gt;Based on your example data, that would appear to work.&lt;/P&gt;&lt;P&gt;If you copy in this example search you can see your spath and stats command do indeed extract the correct data and give you a count of 1, so what is your problem? Are you saying this is not working for you?&lt;/P&gt;&lt;P&gt;If not, it would indicate your data is perhaps not as you have shown.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 04:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741752#M240683</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2025-03-14T04:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Search numbers of messages received by application based on json message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741768#M240692</link>
      <description>&lt;P&gt;Like&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;says, if your data is as you illustrated, and if your search is exactly like you have shown, the search should give you the correct results. &amp;nbsp;So, my speculation is that in your real search, spelling of myfiled in spath and in stats are different. &amp;nbsp;For example, maybe your actual search was spelled like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|spath output=myfiled path=audit.addBy    | stats count by myfield&lt;/LI-CODE&gt;&lt;P&gt;By the way, there should be no need for spath as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;says. &amp;nbsp;This search should give you exactly the same result&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;kubernetes_cluster="abc*" index="aaaa" sourcetype = "kubernetes_logs" source = *pub-sub*
| stats count by audit.addBy&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 06:12:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741768#M240692</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-03-14T06:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search numbers of messages received by application based on json message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741825#M240708</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Due to security I was not sharing complete message . So below mentioned event is getting returned when I run following query :&lt;/P&gt;&lt;P&gt;kubernetes_cluster="aa*" index="aa" sourcetype = "kubernetes_logs" source = *aa*&amp;nbsp; | where (WebserviceAudit="abc" ) and (caller_ip ="def" )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to further filter the data by saying where audit.addby =pp and then count of such events&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me share snapshot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Punnu_1-1741966046197.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38199iA9499BC8BC2CC15E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Punnu_1-1741966046197.png" alt="Punnu_1-1741966046197.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 15:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741825#M240708</guid>
      <dc:creator>Punnu</dc:creator>
      <dc:date>2025-03-14T15:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Search numbers of messages received by application based on json message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741861#M240710</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;Due to security I was not sharing complete message . So below mentioned event is getting returned&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You can post sample event in text after sanitation, that is, replacing sensitive information, be it field name or field value, with fake strings. &amp;nbsp;The key is to preserve structure of data, such as punctuation and other "major separators".&lt;/P&gt;&lt;P&gt;Based on your screenshot, it is clear that your events themselves are not in JSON. &amp;nbsp; That is why the field audit.addBy is not present at search time. &amp;nbsp;This is also why your spath command has no effect. &amp;nbsp;On the other hand, your events do contain a JSON message.&lt;/P&gt;&lt;P&gt;What you need is to &lt;STRONG&gt;first&lt;/STRONG&gt; extract that JSON message. &amp;nbsp;Try this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;kubernetes_cluster="abc*" index="aaaa" sourcetype = "kubernetes_logs" source = *pub-sub*
| rex "^[^\{]+(?&amp;lt;json_portion&amp;gt;\{.+\})"
| spath input=json_portion path=audit.addBy
| stats count by audit.addBy&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 19:22:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-numbers-of-messages-received-by-application-based-on-json/m-p/741861#M240710</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-03-14T19:22:47Z</dc:date>
    </item>
  </channel>
</rss>

