You want to know if the real-time connection information served by Google Analytics is accurate and you need to compare with your web server's log. Perhaps, you just want to find out which IP addresses are being served by your website server. How to that in Unix or Linux ?

Solution :

Instead of relying on monitoring log files with tail -f command. You can get real time information on the IP addresses currently being served by your web server.

Use the netstat -tn 2 > /dev/null command to get the Active Internet connections information.

However, we need to filter out the connections that are connected to port 80(http) or 443(SSL - https connection). This can be done easily by piping the result from netstat to grep command. Change grep to :80 if your web server is not serving via https/SSL.

By Adam Ng

IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.