<?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: Error in 'stats' command: The argument 'span=1min' is invalid. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742909#M240978</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/308914"&gt;@dtapia&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;as you can ead at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.4.1/SearchReference/Stats" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.4.1/SearchReference/Stats&lt;/A&gt; you cannot use the span option in the stats command, it's possible to use it only in the tstats or timechart commands but not in stats.&lt;/P&gt;&lt;P&gt;In this case, you have to add a ne command bin or bucket before the ststs command, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=transactions
tipo_transaccion="Retiro de Efectivo"
(emisor="VISA" AND tipo_cuenta="Crédito")
| eval is_authorized=if(codigo_respuesta=="00" OR codigo_respuesta=="000", 1, 0)
| eval is_declined=if(is_authorized==0 AND (codigo_respuesta!="91" AND codigo_respuesta!="68" AND codigo_respuesta!="timeout"), 1, 0)
| eval is_timeout=if(codigo_respuesta=="91" OR codigo_respuesta=="68" OR codigo_respuesta=="timeout", 1, 0)
| bin span=1m _time
| stats
count as total_txn,
sum(is_authorized) as authorized_txn,
sum(is_declined) as declined_txn,
sum(is_timeout) as timeout_txn,
sum(eval(is_authorized*importe)) as authorized_amount,
sum(eval(is_declined*importe)) as declined_amount,
sum(eval(is_timeout*importe)) as timeout_amount
by _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2025 06:54:50 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2025-03-28T06:54:50Z</dc:date>
    <item>
      <title>Error in 'stats' command: The argument 'span=1min' is invalid.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742908#M240977</link>
      <description>&lt;P&gt;Help: when i try to run the following a get Error in 'stats' command: The argument 'span=1min' is invalid.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;index=transactions &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;tipo_transaccion="Retiro de Efectivo" &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(emisor="VISA" AND tipo_cuenta="Crédito")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;| eval is_authorized=if(codigo_respuesta=="00" OR codigo_respuesta=="000", 1, 0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;| eval is_declined=if(is_authorized==0 AND (codigo_respuesta!="91" AND codigo_respuesta!="68" AND codigo_respuesta!="timeout"), 1, 0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;| eval is_timeout=if(codigo_respuesta=="91" OR codigo_respuesta=="68" OR codigo_respuesta=="timeout", 1, 0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;| stats &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;count as total_txn,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum(is_authorized) as authorized_txn,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum(is_declined) as declined_txn,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum(is_timeout) as timeout_txn,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum(eval(is_authorized*importe)) as authorized_amount,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum(eval(is_declined*importe)) as declined_amount,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum(eval(is_timeout*importe)) as timeout_amount&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;by _time span="1min"&lt;BR /&gt;&lt;BR /&gt;Please your support I really don't know what is causing the mistake&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;regards&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dtapia&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Mar 2025 06:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742908#M240977</guid>
      <dc:creator>dtapia</dc:creator>
      <dc:date>2025-03-28T06:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'stats' command: The argument 'span=1min' is invalid.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742909#M240978</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/308914"&gt;@dtapia&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;as you can ead at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.4.1/SearchReference/Stats" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.4.1/SearchReference/Stats&lt;/A&gt; you cannot use the span option in the stats command, it's possible to use it only in the tstats or timechart commands but not in stats.&lt;/P&gt;&lt;P&gt;In this case, you have to add a ne command bin or bucket before the ststs command, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=transactions
tipo_transaccion="Retiro de Efectivo"
(emisor="VISA" AND tipo_cuenta="Crédito")
| eval is_authorized=if(codigo_respuesta=="00" OR codigo_respuesta=="000", 1, 0)
| eval is_declined=if(is_authorized==0 AND (codigo_respuesta!="91" AND codigo_respuesta!="68" AND codigo_respuesta!="timeout"), 1, 0)
| eval is_timeout=if(codigo_respuesta=="91" OR codigo_respuesta=="68" OR codigo_respuesta=="timeout", 1, 0)
| bin span=1m _time
| stats
count as total_txn,
sum(is_authorized) as authorized_txn,
sum(is_declined) as declined_txn,
sum(is_timeout) as timeout_txn,
sum(eval(is_authorized*importe)) as authorized_amount,
sum(eval(is_declined*importe)) as declined_amount,
sum(eval(is_timeout*importe)) as timeout_amount
by _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 06:54:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742909#M240978</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-03-28T06:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'stats' command: The argument 'span=1min' is invalid.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742915#M240980</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/308914"&gt;@dtapia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The `stats` command doesnt allow for a span with splitting by _time, instead you should either use timechart (which I believe would work in this case - just replace "stats" for "timechart")&amp;nbsp;&lt;/P&gt;&lt;P&gt;or you could use the `bin` command (`| bin _time span=1min` BEFORE the `stats` command then you can use | stats count..sum...etc.. BY _time (without the span) and it will be in 1 min blocks.&lt;/P&gt;&lt;P&gt;Please let me know how you get on and consider adding karma to this or any other answer if it has helped.&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Will&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 09:56:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742915#M240980</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-03-28T09:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'stats' command: The argument 'span=1min' is invalid.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742988#M240992</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello GCusello,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thank you very much for the support, it worked very well&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DTapia&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Mar 2025 02:16:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742988#M240992</guid>
      <dc:creator>dtapia</dc:creator>
      <dc:date>2025-03-29T02:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'stats' command: The argument 'span=1min' is invalid.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742992#M240993</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;, thank you so much for your feedback, they were very helpful in getting my Dashboard working in Splunk, thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DTapia&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Mar 2025 05:27:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/742992#M240993</guid>
      <dc:creator>dtapia</dc:creator>
      <dc:date>2025-03-29T05:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'stats' command: The argument 'span=1min' is invalid.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/743049#M241003</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/308914"&gt;@dtapia&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;let us know if we can help you more, or, please, accept one answer for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Mar 2025 12:36:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-stats-command-The-argument-span-1min-is-invalid/m-p/743049#M241003</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-03-30T12:36:35Z</dc:date>
    </item>
  </channel>
</rss>

