<?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 the count of each Windows event code in my data and run arithmetic operations with these counts to display on a timechart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216428#M63501</link>
    <description>&lt;P&gt;What about:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=somehostnames* sourcetype="WinEventLog:Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | timechart count(eval(EventCode="21")) AS "Logons"  count(eval(EventCode="23")) AS "Logoffs" | eval Difference = (Logons - Logoffs)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Apr 2016 22:04:17 GMT</pubDate>
    <dc:creator>Jeremiah</dc:creator>
    <dc:date>2016-04-18T22:04:17Z</dc:date>
    <item>
      <title>How to search the count of each Windows event code in my data and run arithmetic operations with these counts to display on a timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216426#M63499</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I have some Windows event log data with 5 different event codes. I need to count by each of the event codes and then perform basic arithmetic on those counts. For example, event code 21 is logon, event code 23 is logoff. I need to count logons and then logoffs and then subtract logoffs from logons. I can do this all using stats for a 1 time answer, but I really want to be able to dump it into something like timechart so I can see the difference over time (hourly or daily).&lt;/P&gt;

&lt;P&gt;The best I have right now is the one-time view with Stats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=somehostnames* sourcetype="WinEventLog:Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | stats count(eval(EventCode="21")) AS "Logons", count(eval(EventCode="23")) AS "Logoffs" | eval Difference = (Logons - Logoffs) | stats sum(Difference)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or the timechart with each of the individual event codes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=somehostnames* sourcetype="WinEventLog:Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | timechart count by EventCode
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does anyone have any suggestions? Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 21:29:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216426#M63499</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2016-04-18T21:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of each Windows event code in my data and run arithmetic operations with these counts to display on a timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216427#M63500</link>
      <description>&lt;P&gt;Add &lt;CODE&gt;| bucket _time span=1h|&lt;/CODE&gt;  to your first search string to get hourly changes, and for daily do &lt;CODE&gt;| bucket _time span=1d|&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=somehostnames* sourcetype="WinEventLog:Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | bucket _time span=1h | stats count(eval(EventCode="21")) AS "Logons", count(eval(EventCode="23")) AS "Logoffs" by _time | eval Difference = (Logons - Logoffs) | table _time Difference
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Apr 2016 21:57:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216427#M63500</guid>
      <dc:creator>jensonthottian</dc:creator>
      <dc:date>2016-04-18T21:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of each Windows event code in my data and run arithmetic operations with these counts to display on a timechart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216428#M63501</link>
      <description>&lt;P&gt;What about:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=somehostnames* sourcetype="WinEventLog:Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | timechart count(eval(EventCode="21")) AS "Logons"  count(eval(EventCode="23")) AS "Logoffs" | eval Difference = (Logons - Logoffs)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Apr 2016 22:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-each-Windows-event-code-in-my-data/m-p/216428#M63501</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2016-04-18T22:04:17Z</dc:date>
    </item>
  </channel>
</rss>

