<?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 Cant build a table with command &amp;quot;stats count&amp;quot; in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660517#M17599</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;we would like to extend our alarm for our users' monthly failed logon. I have created the following script. There is a problem with the table. The table is not showing me the "Workstation" and "Source_Network_Address", the Affected and the Count are working fine.&lt;/P&gt;&lt;P&gt;I did some troubleshooting and found out that the command line with "stats count as" is the reason, as it works without that and shows everything except Count then of course.&lt;/P&gt;&lt;P&gt;Does anyone have an idea how I can create a table and a counter?&lt;/P&gt;&lt;P&gt;index=*.....&lt;BR /&gt;(Account_Name="*" OR Group_Name="*")&lt;BR /&gt;EventCode="4625"&lt;BR /&gt;NOT EventCode IN ("4735", "4737", "4755")&lt;BR /&gt;NOT Account_Name="*$*"&lt;BR /&gt;Name&lt;/P&gt;&lt;P&gt;| eval time=_time&lt;BR /&gt;| eval Operator=mvindex(Account_Name, 0)&lt;BR /&gt;| eval Affected=mvindex(Account_Name, 1)&lt;BR /&gt;| eval Group=mvindex(Account_Name, 2)&lt;BR /&gt;| eval Workstation=mvindex(Workstation_Name, 0)&lt;BR /&gt;| eval Group=if(isnull(Group),Group_Name,Group)&lt;BR /&gt;| eval Workstation=if(isnull(Workstation),"",Workstation)&lt;BR /&gt;| eval Workstation=nullif(Workstation,"")&lt;BR /&gt;| eval Affected=if(isnull(Affected),Account_Name,Affected)&lt;BR /&gt;| eval ExpirationTime=if(isnull(Expiration_time),"",Expiration_time)&lt;BR /&gt;| rex field=Message "(?&amp;lt;Message&amp;gt;[^\n]+)"&lt;/P&gt;&lt;P&gt;| stats count as Count by Affected&lt;BR /&gt;| table Affected, Workstation, Source_Network_Address, Count&lt;BR /&gt;| sort -Count&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2023 12:00:40 GMT</pubDate>
    <dc:creator>Miloš</dc:creator>
    <dc:date>2023-10-12T12:00:40Z</dc:date>
    <item>
      <title>Cant build a table with command "stats count"</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660517#M17599</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;we would like to extend our alarm for our users' monthly failed logon. I have created the following script. There is a problem with the table. The table is not showing me the "Workstation" and "Source_Network_Address", the Affected and the Count are working fine.&lt;/P&gt;&lt;P&gt;I did some troubleshooting and found out that the command line with "stats count as" is the reason, as it works without that and shows everything except Count then of course.&lt;/P&gt;&lt;P&gt;Does anyone have an idea how I can create a table and a counter?&lt;/P&gt;&lt;P&gt;index=*.....&lt;BR /&gt;(Account_Name="*" OR Group_Name="*")&lt;BR /&gt;EventCode="4625"&lt;BR /&gt;NOT EventCode IN ("4735", "4737", "4755")&lt;BR /&gt;NOT Account_Name="*$*"&lt;BR /&gt;Name&lt;/P&gt;&lt;P&gt;| eval time=_time&lt;BR /&gt;| eval Operator=mvindex(Account_Name, 0)&lt;BR /&gt;| eval Affected=mvindex(Account_Name, 1)&lt;BR /&gt;| eval Group=mvindex(Account_Name, 2)&lt;BR /&gt;| eval Workstation=mvindex(Workstation_Name, 0)&lt;BR /&gt;| eval Group=if(isnull(Group),Group_Name,Group)&lt;BR /&gt;| eval Workstation=if(isnull(Workstation),"",Workstation)&lt;BR /&gt;| eval Workstation=nullif(Workstation,"")&lt;BR /&gt;| eval Affected=if(isnull(Affected),Account_Name,Affected)&lt;BR /&gt;| eval ExpirationTime=if(isnull(Expiration_time),"",Expiration_time)&lt;BR /&gt;| rex field=Message "(?&amp;lt;Message&amp;gt;[^\n]+)"&lt;/P&gt;&lt;P&gt;| stats count as Count by Affected&lt;BR /&gt;| table Affected, Workstation, Source_Network_Address, Count&lt;BR /&gt;| sort -Count&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 12:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660517#M17599</guid>
      <dc:creator>Miloš</dc:creator>
      <dc:date>2023-10-12T12:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cant build a table with command "stats count"</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660520#M17600</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command is a transforming one, meaning it changes the results so only the referenced fields exist.&amp;nbsp; In this case, only the Count and Affected fields are available to subsequent commands.&amp;nbsp; Perhaps the best fix is to use the &lt;FONT face="courier new,courier"&gt;eventstats&lt;/FONT&gt; command, which is not transforming.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats count as Count by Affected
| table Affected, Workstation, Source_Network_Address, Count
| sort - Count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 12:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660520#M17600</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-10-12T12:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cant build a table with command "stats count"</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660527#M17603</link>
      <description>&lt;P&gt;Thank you for the fast answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now i can see all columns, but the Events in the Statistics are separate and not grouped. Now i see for example 50 times one user and then the another one 20 times, and so on.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Splunk.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27550iECC25F56F0C816EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Splunk.png" alt="Splunk.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 13:28:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660527#M17603</guid>
      <dc:creator>Miloš</dc:creator>
      <dc:date>2023-10-12T13:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cant build a table with command "stats count"</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660528#M17604</link>
      <description>&lt;P&gt;That's not optimal.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Try this alternative using stats.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as Count, values(Workstation) as Workstation, values(Source_Network_Address) as Source_Network_Address by Affected
| table Affected, Workstation, Source_Network_Address, Count
| sort - Count&lt;/LI-CODE&gt;&lt;P&gt;This may yield multiple workstation or source address values for each Affected value.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 13:38:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660528#M17604</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-10-12T13:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cant build a table with command "stats count"</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660988#M17653</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for the help. Now we have a solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 10:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Cant-build-a-table-with-command-quot-stats-count-quot/m-p/660988#M17653</guid>
      <dc:creator>Miloš</dc:creator>
      <dc:date>2023-10-17T10:20:29Z</dc:date>
    </item>
  </channel>
</rss>

