STATS NOMBRE DE CONNEXION LINUX

Exemple sur le port 80

netstat -tan | grep ‘:80 ‘ | awk ‘{print $6}’ | sort | uniq -c

This entry was posted in astuces, bash, linux. Bookmark the permalink.

One Response to STATS NOMBRE DE CONNEXION LINUX

  1. Bertrand says:

    Salut,

    super ton blog, il rempli bien sa fonction “Des astuces rien que des astuces”

    Comme j’ai bien apprécié quelques une de tes astuces je te propose ce “petit” one-line awk pour faire une statistique en pourcentage d’utilisations des navigateurs sur les access_log d’un serveur :

    awk ‘BEGIN{ff=0;chr=0;sf=0}{if($0~/Firefox/){ff=ff+1}if($0~/Safari/){sf=sf+1}if($0~/Chrome/){chr=chr+1} }END {total=(chr+ff+sf); print “Total : “total “\nSafari : ” (sf/total*100) “\nFirefox : “(ff/total*100) “\nChrome : “(chr/total*100) }’ /www/logs/access_log

    A adapter bien sur. Cette commande permet de traiter assez rapidement de gros fichiers access.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>