See active connection on apache web server

6

1

I need a command or something to see live web viewer in Apache2 web server, in other word i want see the ip address of active connection and i found some commands like :

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1

netstat -plan|grep :80 | wc -l

netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | awk '{ printf("%s\t%s\t",$2,$1) ; for (i = 0; i < $1; i++) {printf("*")}; print "" }'

But i can't understand it completely . My questions are :

1 - Is there any other command to server this purpose ?

2 - What is the the state of live visitors in netstat (Establish or Connected) ?

user180445

Posted 2013-03-20T06:49:25.123

Reputation:

Answers

2

Check out Apache mod_status, this gives an overview of activity at the HTTP level and might be what you're looking for.

Sample output of mod_status

Martijn

Posted 2013-03-20T06:49:25.123

Reputation: 121

2Note that to avoid using a web browser, you can run apachectl fullstatus. (This still uses an HTTP connection, however, so you still need to fully configure mod_status before using it). – pistache – 2013-03-20T09:04:35.527

@pistache it doesn't need a GUI web browser, but it does need a text mode browser – Rich Homolka – 2013-04-12T02:49:33.600

1

TCP sessions with respect to HTTP are very short lived. Unless I'm viewing a large file, the TCP sessions change to FIN_WAIT_2 and TIME_WAIT within 5 or 10 seconds, so for stateful HTTP connections, web server utilities such as mod_status and apachectl will need to be used. In other words, there isn't a relationship between TCP session state, and an HTTP session state.

Nevin Williams

Posted 2013-03-20T06:49:25.123

Reputation: 3 725

0

  1. I think for seeing current ip connectivity only this is the command there . You can refer this for advacned usage http://www.thegeekstuff.com/2010/03/netstat-command-examples/

  2. It shows all type of connections time_out , Time_wait , and connected and established in state .

For the above commands, you can do google

adithya

Posted 2013-03-20T06:49:25.123

Reputation: 301

This is a poor answer, it basically tells you to use Google. You need to post an actual answer, that is specific to the question. Imagine there was no Google. – Elijah Lynn – 2017-09-14T21:29:46.057

Thanks for your answer , but i want to know when a visitor , viewing the page , what is the state of his/her connection ? – None – 2013-03-20T08:17:23.640

Well all you have to do is lookup tools to get the ip address and then the netstat to view their connection activity which is shown in status.There are many lookup tools available to work with cpanel the linux variant , sometimes your web hoster will give you the tool himself. – adithya – 2013-03-20T09:12:28.177

If it has helped you please tick green TICK MARK . It will help the future users . – adithya – 2013-03-24T18:16:54.697

I am looking for precise answer , i don't leave it be.as soon as i get it i put the answer here for other user, thanks. – None – 2013-03-24T18:43:13.627