<?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: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484469#M135607</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="YouShouldAlwaysSpecifyAnIndex" AND sourcetype="AndSourcetypeToo" AND %ASA-6-3020* AND NOT %ASA-6-302010
| rex "(?&amp;lt;protocol&amp;gt;UDP|TCP|ICMP)"
| timechart count AS debugCount count(eval(searchmatch("Built"))) AS Built count(eval(searchmatch("Teardown"))) AS Teardown BY protocol Cisco_ASA_message_id
| eval Opened = Built - Teardown
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 19 Jan 2020 22:41:13 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2020-01-19T22:41:13Z</dc:date>
    <item>
      <title>Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484466#M135604</link>
      <description>&lt;P&gt;Hi, i'm getting stuck an weird using Splunk to show me am Timechart for the last 30 days with open connection per protocol. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Input looks like&lt;/EM&gt;:&lt;BR /&gt;
Jan 17 13:19:34 mydevice : %ASA-6-302013: Built outbound TCP connection&lt;BR /&gt;
Jan 17 13:19:34 mydevice : %ASA-6-302014: Teardown TCP connection&lt;BR /&gt;
Jan 17 13:19:34 mydevice : %ASA-6-302016: Teardown UDP connection&lt;BR /&gt;
Jan 17 13:19:34 mydevice : %ASA-6-302015: Built outbound UDP connection&lt;BR /&gt;
Jan 17 13:19:34 mydevice :  %ASA-6-302021: Teardown ICMP connection&lt;BR /&gt;
Jan 17 13:19:34 mydevice: %ASA-6-302020: Built outbound ICMP connection&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;my search statement&lt;/EM&gt;:&lt;BR /&gt;
%ASA-6-3020* NOT %ASA-6-302010 | timechart count by Cisco_ASA_message_id       &lt;/P&gt;

&lt;P&gt;brings up a wonderful timechart table with absolute values on how many connections were built and closed in a specific timeperiod.&lt;BR /&gt;
it shows me the amount of built TCP connections , teardowned TCP connections built UDP connections, and so on.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Goal&lt;/EM&gt;: My Goal ist a timechart on a statement like: Opened TCP connections = Built TCP connections - Teardowned TCP connection so i' receive three lines (one for each Protocol TCP,UDP and ICMP). Each Cisco_ASA_message_id stands for a specific event.&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;

&lt;P&gt;regards from an absolute beginner&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:41:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484466#M135604</guid>
      <dc:creator>rhornung</dc:creator>
      <dc:date>2020-09-30T03:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484467#M135605</link>
      <description>&lt;P&gt;something like this? I threw in to only show fields "Cisco_ASA_message_id" since I know ASA is intensive. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype="cisco:asa" Cisco_ASA_message_id="3020*" NOT Cisco_ASA_message_id="302010"
| fields Cisco_ASA_message_id
| eval connection_type = case(Cisco_ASA_message_id==302013 OR Cisco_ASA_message_id==302014,"tcp", Cisco_ASA_message_id==302015 OR Cisco_ASA_message_id==302016,"upd", Cisco_ASA_message_id==302020 OR Cisco_ASA_message_id==302021,"icmp")
| timechart count by connection_type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:45:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484467#M135605</guid>
      <dc:creator>jscraig2006</dc:creator>
      <dc:date>2020-09-30T03:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484468#M135606</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;your_search
| rex  "(?&amp;lt;connection&amp;gt;Built|Teardown).*(?&amp;lt;protocol&amp;gt;(TCP|UDP|ICMP))\s+connection$" 
| table _time connection protocol 
| bin _time span=10m 
| stats count as Count by _time connection protocol 
| stats sum(eval(if(connection="Built",Count,NULL))) as Built sum(eval(if(connection="Teardown",Count,NULL))) as Teardown by _time protocol 
| fillnull 
| eval Open=Built-Teardown 
| xyseries _time protocol Open
| fillnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;bin _time span=10m&lt;/CODE&gt;  Time span is as you like.&lt;/P&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Jan 17 13:19:34 mydevice : %ASA-6-302013: Built outbound TCP connection
Jan 17 13:19:35 mydevice : %ASA-6-302014: Teardown TCP connection
Jan 17 13:19:36 mydevice : %ASA-6-302016: Teardown UDP connection
Jan 17 13:19:37 mydevice : %ASA-6-302015: Built outbound UDP connection
Jan 17 13:19:38 mydevice : %ASA-6-302021: Teardown ICMP connection
Jan 17 13:19:39 mydevice : %ASA-6-302020: Built outbound ICMP connection
Jan 17 13:19:40 mydevice : %ASA-6-302013: Built outbound TCP connection
Jan 17 13:19:41 mydevice : %ASA-6-302014: Teardown TCP connection
Jan 17 13:19:42 mydevice : %ASA-6-302016: Teardown UDP connection
Jan 17 13:19:43 mydevice : %ASA-6-302015: Built outbound UDP connection
Jan 17 13:19:44 mydevice : %ASA-6-302021: Teardown ICMP connection
Jan 17 13:19:45 mydevice : %ASA-6-302020: Built outbound ICMP connection" 
| makemv delim="
" _raw 
| stats count by _raw 
| rex "(?&amp;lt;_time&amp;gt;\w+ \d\d \d\d:\d\d:\d\d) (?&amp;lt;device&amp;gt;\w+)\s*: (?&amp;lt;Cisco_ASA_message_id&amp;gt;\S+): (?&amp;lt;Cisco_ASA_message&amp;gt;.+)" 
| eval _time=strptime(_time,"%b %d %T") 
| table _time device Cisco_ASA_message_id Cisco_ASA_message _raw
    `comment("this is sample you provide")`
    `comment("From here, the logic")`
| rex field=Cisco_ASA_message "(?&amp;lt;protocol&amp;gt;\w+)\s+connection"
| streamstats count(eval(searchmatch("Built"))) as session by protocol
| stats min(_time) as starttime max(_time) as endtime range(_time) as duration by session protocol
| fieldformat starttime=strftime(starttime,"%F %T")
| fieldformat endtime=strftime(endtime,"%F %T")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @rhornung&lt;BR /&gt;
I don't understand &lt;CODE&gt;Goal: My Goal ist a timechart on a statement like: Opened TCP connections = Built TCP connections - Teardowned TCP connection&lt;/CODE&gt;&lt;BR /&gt;
Do you want to create the &lt;STRONG&gt;chart&lt;/STRONG&gt;? X-axis is time and Y-axis ...what?&lt;BR /&gt;
Please tell me the details.&lt;/P&gt;

&lt;P&gt;Above query, Each protocol's start and end time is listed. and duration(sec).&lt;BR /&gt;
&lt;EM&gt;duration&lt;/EM&gt;  is "0" , because protocol does not start &lt;CODE&gt;Built&lt;/CODE&gt; in this log.&lt;/P&gt;

&lt;P&gt;Actually searching, please select right time range.  and use &lt;CODE&gt;reverse&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Because, basically, the latest log is at the top of the list. This case, this query does not work.&lt;BR /&gt;
Old logs need to be on top using &lt;CODE&gt;reverse&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;How about this?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 03:32:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484468#M135606</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-18T03:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484469#M135607</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="YouShouldAlwaysSpecifyAnIndex" AND sourcetype="AndSourcetypeToo" AND %ASA-6-3020* AND NOT %ASA-6-302010
| rex "(?&amp;lt;protocol&amp;gt;UDP|TCP|ICMP)"
| timechart count AS debugCount count(eval(searchmatch("Built"))) AS Built count(eval(searchmatch("Teardown"))) AS Teardown BY protocol Cisco_ASA_message_id
| eval Opened = Built - Teardown
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jan 2020 22:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484469#M135607</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-01-19T22:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484470#M135608</link>
      <description>&lt;P&gt;Hi to4kawa,&lt;/P&gt;

&lt;P&gt;Thanks for your input and response. &lt;BR /&gt;
To answer your question:&lt;/P&gt;

&lt;P&gt;I want to create a &lt;STRONG&gt;timechart&lt;/STRONG&gt; with 3 lines (each line stands for one protocol TCP, UDP an ICMP) where x -axis shows the timeline an the y -axis shows me the count of opened connections during the calculated span time.&lt;/P&gt;

&lt;P&gt;The ASA Logfile only gives me Built and Teardown events, so the current opened connections for each moment of time hast to be calculated: opened connections = Created (-&amp;gt;Built) - closed(-&amp;gt;Teardown) connections.&lt;/P&gt;

&lt;P&gt;I want to get a feeling on whats happening on the ASA, so the purpose for this timechart is to get a time-based baseline which shows me anomalies on the firewall-activities.&lt;/P&gt;

&lt;P&gt;Hope this explanation helps.&lt;/P&gt;

&lt;P&gt;Thx in advance&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 05:41:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484470#M135608</guid>
      <dc:creator>rhornung</dc:creator>
      <dc:date>2020-01-20T05:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484471#M135609</link>
      <description>&lt;P&gt;Hi jscraig2006&lt;/P&gt;

&lt;P&gt;Thank you for your input and response on my question.&lt;/P&gt;

&lt;P&gt;Your query summarizes the count of built and teardown events, so i get the total amount on events for each protocol.&lt;/P&gt;

&lt;P&gt;As i wrote (and for baselining reasons) i'd prefer a timechart where &lt;STRONG&gt;open connections are calculated as Built - Teardown Events.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 06:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484471#M135609</guid>
      <dc:creator>rhornung</dc:creator>
      <dc:date>2020-01-20T06:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484472#M135610</link>
      <description>&lt;P&gt;Hi Splunk-Community&lt;/P&gt;

&lt;P&gt;After several tries and being inspired by above samples (many thanks to repliers) my search query looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex AND sourcetype="my_sourcecode" AND %ASA-6-3020* AND NOT %ASA-6-302010
| rex "(?&amp;lt;protocol&amp;gt;UDP|TCP|ICMP)" 
| eval connection=case(Cisco_ASA_message_id=="302013" OR Cisco_ASA_message_id=="302015" OR Cisco_ASA_message_id=="302020",1,
                       Cisco_ASA_message_id=="302014" OR Cisco_ASA_message_id=="302016" OR Cisco_ASA_message_id=="302021",-1)
| timechart sum(connection) by protocol
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query creates a field connection with the values 1 if the field Cisco_ASA_message_id conforms to "Built" Events and a -1 if the field Cisco_ASA_message_id conforms to "Teardown" Events.&lt;/P&gt;

&lt;P&gt;It works but takes very long (for a report period of 7 days) maybe there is an option or other way to accelerate it!???&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:45:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484472#M135610</guid>
      <dc:creator>rhornung</dc:creator>
      <dc:date>2020-09-30T03:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484473#M135611</link>
      <description>&lt;P&gt;Hi, to4kawa,&lt;/P&gt;

&lt;P&gt;Finally your solution works fine for me!&lt;CODE&gt;your_search&lt;BR /&gt;
     | rex  "(?&amp;lt;connection&amp;gt;Built|Teardown).*(?&amp;lt;protocol&amp;gt;(TCP|UDP|ICMP))\s+connection$" &lt;BR /&gt;
     | table _time connection protocol &lt;BR /&gt;
     | bin _time span=10m &lt;BR /&gt;
     | stats count as Count by _time connection protocol &lt;BR /&gt;
     | stats sum(eval(if(connection="Built",Count,NULL))) as Built sum(eval(if(connection="Teardown",Count,NULL))) as Teardown by _time protocol &lt;BR /&gt;
     | fillnull &lt;BR /&gt;
     | eval Open=Built-Teardown &lt;BR /&gt;
     | xyseries _time protocol Open&lt;BR /&gt;
     | fillnull&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Many thanks for your quick reply!  Best regards &lt;BR /&gt;
rhornung&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 13:44:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484473#M135611</guid>
      <dc:creator>rhornung</dc:creator>
      <dc:date>2020-01-20T13:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484474#M135612</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype="my_sourcecode" 
    AND (Cisco_ASA_message_id="302013" OR Cisco_ASA_message_id="302015" OR Cisco_ASA_message_id="302020" OR Cisco_ASA_message_id="302014" 
    OR Cisco_ASA_message_id="302016" OR Cisco_ASA_message_id="302021") 
| rex "(?&amp;lt;protocol&amp;gt;UDP|TCP|ICMP)" 
| eval connection=case(Cisco_ASA_message_id=="302013" OR Cisco_ASA_message_id=="302015" OR Cisco_ASA_message_id="302020",1,
    Cisco_ASA_message_id=="302014" OR Cisco_ASA_message_id=="302016" OR Cisco_ASA_message_id=="302021",-1)
| fields _time protocol connection
| timechart sum(connection) by protocol
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;a little faster. Of course  you use &lt;EM&gt;fast mode&lt;/EM&gt; search don't you?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 13:49:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484474#M135612</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-20T13:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484475#M135613</link>
      <description>&lt;P&gt;I think your query is smarter. &lt;BR /&gt;
search speed is OK?&lt;BR /&gt;
I comment your query. please confirm.&lt;BR /&gt;
Happy splunking.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 13:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484475#M135613</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-20T13:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with count of open connections per protocol (TCP/UDP/ICMP) ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484476#M135614</link>
      <description>&lt;P&gt;Fast Mode-&amp;gt; yes, Thank you for your support and happy splunking! &lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 07:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-count-of-open-connections-per-protocol-TCP-UDP/m-p/484476#M135614</guid>
      <dc:creator>rhornung</dc:creator>
      <dc:date>2020-01-21T07:51:41Z</dc:date>
    </item>
  </channel>
</rss>

