<?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 extract the numeric value and IP address from a string in my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290137#M87711</link>
    <description>&lt;P&gt;You can actually do this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "connection accepted from (?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+) connections" | table _time ConnectionCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will display all the points with corresponding connection count. Please note that there is a limit on how many points can be plotted in the chart  so it may not show all points based on how much data you select. See this for more details:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.0/Viz/ChartDisplayissues#Time_charting"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.0/Viz/ChartDisplayissues#Time_charting&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2017 17:44:53 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-10-06T17:44:53Z</dc:date>
    <item>
      <title>How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290132#M87706</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;

&lt;P&gt;My log contains below entries.&lt;/P&gt;

&lt;P&gt;2017-10-06T04:19:25.658+0000 I NETWORK  [initandlisten] connection accepted from 12.34.56.789:12345 #192 &lt;STRONG&gt;(10 connections now open)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I am looking for 2 things.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;I want to create a timechart for "Totalconnections". This information will come from the string "(10 connections now open)" and I want to timechart the number &lt;CODE&gt;10&lt;/CODE&gt; &lt;/LI&gt;
&lt;LI&gt; I want to count the IPaddress to know how many connections there are per IP.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 06 Oct 2017 16:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290132#M87706</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-06T16:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290133#M87707</link>
      <description>&lt;P&gt;You need to first capture those IP and connection number into field, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "connection accepted from (?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+) connections"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you can do total connection timechart like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;above search | timechart sum(ConnectionCount) as TotalConnections
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For count of connections per IP address&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;above search | timechart sum(ConnectionCount) as TotalConnections by IPAddress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2017 16:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290133#M87707</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-10-06T16:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290134#M87708</link>
      <description>&lt;P&gt;Below query is giving me output 500 to 1100 connections but as per my logs connections are in between 10 to 30.&lt;BR /&gt;
ring=xxxx  source=xxxx "NETWORK" earliest=-4h | rex "connection accepted from (?\d+.\d+.\d+.\d+):[^(]+((?\d+) connections"| timechart sum(ConnectionCount) as TotalConnections&lt;/P&gt;

&lt;P&gt;lets not worry about Connection per IP for now, I just need connection count i.e 10 &lt;BR /&gt;
from  this string  &lt;STRONG&gt;(10 connections now open)&lt;/STRONG&gt; because these are real connections.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Here is the log sample:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;2017-10-06T04:01:24.889+0000 I NETWORK  [conn183] end connection xxx (9 connections now open)&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 17:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290134#M87708</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-06T17:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290135#M87709</link>
      <description>&lt;P&gt;In stats, use max or latest instead of sum.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "connection accepted from (?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+) connections" | timechart max(ConnectionCount) as TotalConnections
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "connection accepted from (?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+) connections" | timechart latest(ConnectionCount) as TotalConnections
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2017 17:22:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290135#M87709</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-10-06T17:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290136#M87710</link>
      <description>&lt;P&gt;Thanks Somesoni!&lt;/P&gt;

&lt;P&gt;Can't I get exact connected sessions graph instead of Max/Latest/avg?&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
From log entries at 04:05:53.268 I have 12 open connections (I just want to see in my graph 12 at that timestamp) and at  4:19:25.658 I have 10 connections open, so when I do plot a graph I want to see exact count so that I will get idea how many sessions were active at particular time.&lt;/P&gt;

&lt;P&gt;2017-10-06T04:05:53.268+0000 I NETWORK [initandlisten] connection accepted from IP:PORT #187 (12 connections now open)&lt;/P&gt;

&lt;P&gt;2017-10-06T04:19:25.658+0000 I NETWORK [initandlisten] connection accepted from IP:Port (10 connections now open)&lt;/P&gt;

&lt;P&gt;2017-10-06T04:23:55.733+0000 I NETWORK [initandlisten] connection accepted from  #193 (10 connections now open)&lt;/P&gt;

&lt;P&gt;Sorry I am very new to splunk, we just started using this.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 17:39:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290136#M87710</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-06T17:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290137#M87711</link>
      <description>&lt;P&gt;You can actually do this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "connection accepted from (?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+) connections" | table _time ConnectionCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will display all the points with corresponding connection count. Please note that there is a limit on how many points can be plotted in the chart  so it may not show all points based on how much data you select. See this for more details:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.0/Viz/ChartDisplayissues#Time_charting"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.0/Viz/ChartDisplayissues#Time_charting&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 17:44:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290137#M87711</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-10-06T17:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290138#M87712</link>
      <description>&lt;P&gt;Excellent that worked Somesoni!&lt;/P&gt;

&lt;P&gt;But I have multiple hosts on that ring, how do I get per host level?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 17:51:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290138#M87712</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-06T17:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290139#M87713</link>
      <description>&lt;P&gt;Try this (will create a new field with same name as value of field host, and that new field will contains corresponding connection count value)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "connection accepted from (?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+) connections" | table _time host ConnectionCount | eval {host}=ConnectionCount | fields - host ConnectionCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2017 18:02:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290139#M87713</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-10-06T18:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290140#M87714</link>
      <description>&lt;P&gt;Somesoni,  My graph is not showing as timestamp based, it's giving random time results.&lt;/P&gt;

&lt;P&gt;Graph showing like this.&lt;BR /&gt;
example:&lt;BR /&gt;
First it showing 13:19:31 sessions count, second 13:48:01 sessions count and then 13:39:03 timestamp sessions count, it just shows random order.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 14:11:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290140#M87714</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-09T14:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290141#M87715</link>
      <description>&lt;P&gt;Hi Chandukreddi,&lt;/P&gt;

&lt;P&gt;can you please try below search??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR SEARCH | rex "(?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+)" | chart sum(ConnectionCount) as ConnectionCount over _time by  IPAddress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2017 13:45:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290141#M87715</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-10T13:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290142#M87716</link>
      <description>&lt;P&gt;Thanks Kamlesh! it worked!!&lt;/P&gt;

&lt;P&gt;could you please help me on above session count timechart? Somesoni was trying to help me but still I am not getting expected output.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 15:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290142#M87716</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-10T15:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290143#M87717</link>
      <description>&lt;P&gt;Hi ChandukReddi,&lt;BR /&gt;
Sure .. &lt;BR /&gt;
Can you please let me know what you expect as session count from below sample event?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2017-10-06T04:05:53.268+0000 I NETWORK [initandlisten] connection accepted from IP:PORT #187 (12 connections now open)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Oct 2017 05:17:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290143#M87717</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-11T05:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290144#M87718</link>
      <description>&lt;P&gt;Hi Kamlesh,&lt;/P&gt;

&lt;P&gt;I wan to see a number of open connections in timechart graph from above sample log.&lt;/P&gt;

&lt;P&gt;2017-10-06T04:05:53.268+0000 I NETWORK [initandlisten] connection accepted from IP:PORT #187 (12 connections now open)&lt;/P&gt;

&lt;P&gt;At time "2017-10-06T04:05:53" there were total  "12 connections now open", I want to see this session count in graph.&lt;/P&gt;

&lt;P&gt;and also in this ring we have multiple hosts and each host will have same kind of log, so want to get the count by host.&lt;/P&gt;

&lt;P&gt;Mostly I will see open sessions count graph in last 1 hr per minute.&lt;/P&gt;

&lt;P&gt;Please let me know if it is not clear.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 13:54:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290144#M87718</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-11T13:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290145#M87719</link>
      <description>&lt;P&gt;Hi Chandu,&lt;/P&gt;

&lt;P&gt;Can you please execute below search for last 1 hour??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex "(?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+)" | bucket _time span=1m | chart sum(ConnectionCount) as ConnectionCount over _time by  IPAddress
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I have considered "IP" as a host. &lt;BR /&gt;
This search will provide you host wise sum of session count by every minute.&lt;/P&gt;

&lt;P&gt;Kindly correct me if I'm wrong in IP considerations.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 06:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290145#M87719</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-12T06:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290146#M87720</link>
      <description>&lt;P&gt;Hi Kamlesh,&lt;/P&gt;

&lt;P&gt;No we should not count by IP addres, Here is IP address is client ip address.&lt;/P&gt;

&lt;P&gt;I am just looking for total connection in cluster (we have 3 nodes in cluster) and in our logs it shows how many connections were open at that particular time period.&lt;/P&gt;

&lt;P&gt;I just want to filter "12 connections now open" this string from bellow sample log and grep for number 12 and show them in the graph.&lt;/P&gt;

&lt;P&gt;2017-10-06T04:05:53.268+0000 I NETWORK [initandlisten] connection accepted from IP:PORT #187 (12 connections now open)&lt;/P&gt;

&lt;P&gt;Please let me know if I am not clear.&lt;/P&gt;

&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 15:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290146#M87720</guid>
      <dc:creator>chandukreddi</dc:creator>
      <dc:date>2017-10-12T15:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the numeric value and IP address from a string in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290147#M87721</link>
      <description>&lt;P&gt;Hi Chandu,&lt;BR /&gt;
I'm just trying to understand log files and how they forwarded to the indexer.&lt;/P&gt;

&lt;P&gt;These logs are coming from clusters ( means from all the hosts of the cluster). Am I right ?? So we can use host field as cluster host.&lt;/P&gt;

&lt;P&gt;Please check below search. This search will show you a timeline of host wise connection. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR SEARCH | rex "(?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+)" | chart values(ConnectionCount) as ConnectionCount over _time by  host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you found multiple values in ConnectionCount then we have to take latest value from them. So In this case use below search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR SEARCH | rex "(?&amp;lt;IPAddress&amp;gt;\d+\.\d+\.\d+\.\d+):[^\(]+\((?&amp;lt;ConnectionCount&amp;gt;\d+)" | chart latest(ConnectionCount) as ConnectionCount over _time by  host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 04:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-numeric-value-and-IP-address-from-a-string-in/m-p/290147#M87721</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-13T04:51:20Z</dc:date>
    </item>
  </channel>
</rss>

