systemes:linux:logs

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
systemes:linux:logs [2016/01/20 09:56]
william créée
systemes:linux:logs [2019/02/06 14:03] (Version actuelle)
Ligne 8: Ligne 8:
 ====Récupérer un contenu de log entre crochets ==== ====Récupérer un contenu de log entre crochets ====
  
-Format bracket: +  * 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 +  [Wed Jan 20 09:13:50 2016] [error] [client 123.123.123.123] client denied by server configuration: proxy:www.google.com:443 
- +  <code bash>cat vhost_error.log | cut -f 4 -d '[' | cut -f 1 -d ']' | sed 's_client __'
-<code bash>cat vhost_error.log | cut -f 4 -d '[' | cut -f 1 -d ']' | sed 's_client __'+
 123.123.123.123 123.123.123.123
 +....
 </code> </code>
 +
 +
 +====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
 +  * <code bash>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
 +</code>
 +
 +==== Envoi de logs via XMPP ====
 +
 +  * https://github.com/willouuu/Scripts-Python/blob/master/xmpplogs.py
 +  * Editez les champs suivant de xmpplogs.py 
 +  * <code python> server       = 'xmpp.domaine.fr'
 +login        = 'login'
 +password     = 'p4ssWd'
 +destinataire = 'user@domaine.fr'
 +logFile      = "/tmp/log.log"
 +</code>
 +  * Execution : 
 +  * <code bash> 
 +python xmpplogs.py
 +</code>
 +
  
  
 [[systemes:start|Retour]] [[systemes:start|Retour]]
  • systemes/linux/logs.1453280188.txt.gz
  • Dernière modification: 2019/02/06 14:02
  • (modification externe)