====== LINUX : Les logs ====== ===== Introduction ===== ===== Traitement de logs ===== ====Récupérer un contenu de log entre crochets ==== * Format bracket: * [Wed Jan 20 09:13:50 2016] [error] [client 123.123.123.123] client denied by server configuration: proxy:www.google.com:443 * cat vhost_error.log | cut -f 4 -d '[' | cut -f 1 -d ']' | sed 's_client __' 123.123.123.123 .... ====Trier les resultats ==== * Format bracket: * [Wed Jan 20 09:13:50 2016] [error] [client 123.123.123.123] client denied by server configuration: proxy:www.google.com:443 * cat vhost_error.log | cut -f 4 -d '[' | cut -f 1 -d ']' | sed 's_client __' | sort -n | uniq -c 6 123.123.1.1 6 123.123.1.2 13 123.123.1.3 21 123.123.1.4 10 123.123.1.5 27 123.123.1.6 1 123.123.1.7 30 123.123.1.8 14 123.123.1.9 ==== Envoi de logs via XMPP ==== * https://github.com/willouuu/Scripts-Python/blob/master/xmpplogs.py * Editez les champs suivant de xmpplogs.py * server = 'xmpp.domaine.fr' login = 'login' password = 'p4ssWd' destinataire = 'user@domaine.fr' logFile = "/tmp/log.log" * Execution : * python xmpplogs.py [[systemes:start|Retour]]