<?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 stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673669#M230665</link>
    <description>&lt;P&gt;The field _time needs to be available at the time of using the "| timechart " command&lt;BR /&gt;&lt;BR /&gt;you example of:&lt;BR /&gt;&lt;SPAN&gt;index=prueba source="*blablabla*"&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Date=strftime(_time,"%Y/%m/%d")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Time=strftime(_time,"%H:%M:%S")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;| stats values(Fecha) as Fecha, values(transactType) as transactType by ID&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;SPAN&gt;| timechart span=5m count by transactType&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;is not carrying over the_time field from the raw events.&lt;BR /&gt;In the bolded SPL above the stats transformation will need some sort of method of carrying over the&amp;nbsp;&lt;EM&gt;_time&lt;/EM&gt; field&lt;BR /&gt;&lt;BR /&gt;I would recommend either a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    | stats 
        earliest(_time) as _time,
        values(Fecha) as Fecha, 
        values(transactType) as transactType 
            by ID
    | timechart span=5m 
        count as count 
            by transactType&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR a&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    | stats 
        latest(_time) as _time,
        values(Fecha) as Fecha, 
        values(transactType) as transactType 
            by ID
    | timechart span=5m 
        count as count 
            by transactType&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(depending on what makes more sense for your scenario)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So example of your Full SPL would look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
    ``` The field ID is assumed to already be extracted ```
    ``` regex extraction of transactType field ```
    | rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
    ``` transform raw events to singular events, each representing a unique ID with their own list of tranactType value and _time value ```
    | stats 
        latest(_time) as _time,
        values(transactType) as transactType 
            by ID
    ``` make a time series tallying up all the unique IDs belonging to the unique transactType values in 5 minute buckets ```
    | timechart span=5m 
        count as count 
            by transactType&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2024 16:22:56 GMT</pubDate>
    <dc:creator>dtburrows3</dc:creator>
    <dc:date>2024-01-09T16:22:56Z</dc:date>
    <item>
      <title>search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673665#M230664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a log with several transactions, each one have some events. All event in one transaction share the same ID. The other events contains some information each one, for example, execution time, transact type, url. login url, etc.... This fields can be in one or several of the events.&lt;/P&gt;
&lt;P&gt;I want to obtain the total transactions of each type in spanned time, for example each 5m.&lt;/P&gt;
&lt;P&gt;I need to group the events of each trasaction for extract the info for it.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
| eval Date=strftime(_time,"%Y/%m/%d")
| eval Time=strftime(_time,"%H:%M:%S")
| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")
| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
| stats values(Fecha) as Fecha, values(transactType) as transactType by ID&lt;/LI-CODE&gt;
&lt;P&gt;This is Ok, if i want count transactType then i do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
| eval Date=strftime(_time,"%Y/%m/%d")
| eval Time=strftime(_time,"%H:%M:%S")
| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")
| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
| stats values(Fecha) as Fecha, values(transactType) as transactType by ID
|stats count by transactType&lt;/LI-CODE&gt;
&lt;P&gt;The problem is if i want to obtain that in a span time:&lt;BR /&gt;I cant do this because there is some events with the transactType field in one transaction:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
| eval Date=strftime(_time,"%Y/%m/%d")
| eval Time=strftime(_time,"%H:%M:%S")
| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")
| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
| timechart span=5m count by transactType&lt;/LI-CODE&gt;
&lt;P&gt;And following query dont give me any result:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
| eval Date=strftime(_time,"%Y/%m/%d")
| eval Time=strftime(_time,"%H:%M:%S")
| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")
| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
| stats values(Fecha) as Fecha, values(transactType) as transactType by ID
| timechart span=5m count by transactType&lt;/LI-CODE&gt;
&lt;P&gt;Im tried too (but i dont get results):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
| eval Date=strftime(_time,"%Y/%m/%d")
| eval Time=strftime(_time,"%H:%M:%S")
| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")
| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
| bucket Fecha span=5m
| stats values(Fecha) as Fecha, values(transactType) as transactType by ID
|stats count by transactType&lt;/LI-CODE&gt;
&lt;P&gt;Or:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
| eval Date=strftime(_time,"%Y/%m/%d")
| eval Time=strftime(_time,"%H:%M:%S")
| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")
| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
| stats values(Fecha) as Fecha, values(transactType) as transactType by ID
| bucket Fecha span=5m
|stats count by transactType&lt;/LI-CODE&gt;
&lt;P&gt;How can i obtain what i want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 09:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673665#M230664</guid>
      <dc:creator>asncari</dc:creator>
      <dc:date>2024-01-10T09:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673669#M230665</link>
      <description>&lt;P&gt;The field _time needs to be available at the time of using the "| timechart " command&lt;BR /&gt;&lt;BR /&gt;you example of:&lt;BR /&gt;&lt;SPAN&gt;index=prueba source="*blablabla*"&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Date=strftime(_time,"%Y/%m/%d")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Time=strftime(_time,"%H:%M:%S")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Fecha=strftime(_time,"%Y/%m/%d %H:%M:%S")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;| stats values(Fecha) as Fecha, values(transactType) as transactType by ID&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;SPAN&gt;| timechart span=5m count by transactType&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;is not carrying over the_time field from the raw events.&lt;BR /&gt;In the bolded SPL above the stats transformation will need some sort of method of carrying over the&amp;nbsp;&lt;EM&gt;_time&lt;/EM&gt; field&lt;BR /&gt;&lt;BR /&gt;I would recommend either a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    | stats 
        earliest(_time) as _time,
        values(Fecha) as Fecha, 
        values(transactType) as transactType 
            by ID
    | timechart span=5m 
        count as count 
            by transactType&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR a&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    | stats 
        latest(_time) as _time,
        values(Fecha) as Fecha, 
        values(transactType) as transactType 
            by ID
    | timechart span=5m 
        count as count 
            by transactType&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(depending on what makes more sense for your scenario)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So example of your Full SPL would look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=prueba source="*blablabla*" 
    ``` The field ID is assumed to already be extracted ```
    ``` regex extraction of transactType field ```
    | rex "^.+transactType:\s(?P&amp;lt;transactType&amp;gt;(.\w+)+)"
    ``` transform raw events to singular events, each representing a unique ID with their own list of tranactType value and _time value ```
    | stats 
        latest(_time) as _time,
        values(transactType) as transactType 
            by ID
    ``` make a time series tallying up all the unique IDs belonging to the unique transactType values in 5 minute buckets ```
    | timechart span=5m 
        count as count 
            by transactType&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 16:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673669#M230665</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-09T16:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: search stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673680#M230666</link>
      <description>&lt;P&gt;I've tried this, but without de "as _time" Now works perfect.&lt;/P&gt;&lt;P&gt;Thank you very much!!!!!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 17:09:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-stats/m-p/673680#M230666</guid>
      <dc:creator>asncari</dc:creator>
      <dc:date>2024-01-09T17:09:13Z</dc:date>
    </item>
  </channel>
</rss>

