Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Get List Of Connections By Ip

Discussion in 'General Discussion' started by dorac, Jul 30, 2015.

  1. dorac

    dorac Member

    Joined:
    Jun 7, 2013
    Messages:
    22
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    South Africa
    cPanel Access Level:
    Root Administrator
    Hey guys,

    Would anyone know how to get a list of ip addresses that connect to the server, summarize and sort it to ip addresses by connection for a given time period?

    eg. I want the list for July '15

    123.124.125.126 - 2431 Connections
    111.110.100.10 - 1234 Connections
    90.57.28.87 - 542 Connections
    ....

    Any ideas?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,419
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    You may find this command helpful:

    Code:
    netstat -ntu | awk ' $5 ~ /^[0-9]/ {print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
    However, note you can't list the connection by time period because the data is not stored.

    Thank you.
     
Loading...

Share This Page