Diferencia entre revisiones de «One-liners»

De Wiki Técnico Rioja. Administra tus sistemas.
Sin resumen de edición
Sin resumen de edición
Línea 7: Línea 7:
<pre>tail -n 5000 /srv/log/httpd/access_log | awk '{print $2}' | sort | uniq -c |sort -n | tail</pre>
<pre>tail -n 5000 /srv/log/httpd/access_log | awk '{print $2}' | sort | uniq -c |sort -n | tail</pre>


'''Pseudotop con CPU solo de los procesos php'''
<pre>watch "ps -eo pid,user,%cpu,%mem,command --sort=-%cpu | grep '[p]hp-fpm'"</pre>
'''Conexiones a puertos 80|443'''
'''Conexiones a puertos 80|443'''
<pre>netstat -tlna | egrep ":80|:443" | awk {'print $5'} | cut -d ':' -f 1 | sort | uniq -c | sort -n | tail</pre>
<pre>netstat -tlna | egrep ":80|:443" | awk {'print $5'} | cut -d ':' -f 1 | sort | uniq -c | sort -n | tail</pre>


Línea 15: Línea 17:
<pre>cat  /srv/log/httpd/access_log | awk '{print $1" " $2 " " $8}' | grep xmlrpc.php | sort | uniq -c |sort -n | tail</pre>
<pre>cat  /srv/log/httpd/access_log | awk '{print $1" " $2 " " $8}' | grep xmlrpc.php | sort | uniq -c |sort -n | tail</pre>


Buscar errores 404|403
'''Buscar errores 404|403'''


<pre>cat /srv/log/httpd/access_log | grep -E 'HTTP/2.0" (403|404)' | awk '{print $1, $2, $8, $10}' | sort | uniq -c | sort -n | tail -n 50</pre>
<pre>cat /srv/log/httpd/access_log | grep -E 'HTTP/2.0" (403|404)' | awk '{print $1, $2, $8, $10}' | sort | uniq -c | sort -n | tail -n 50</pre>


 
'''Reiniciar Apache + php-fpm + xymon'''
Reiniciar Apache + php-fpm + xymon


<pre> systemctl restart php* httpd xymon </pre>
<pre> systemctl restart php* httpd xymon </pre>


===Mysql===
===Mysql===

Revisión del 07:50 30 ene 2025

Apache

Últimas 5000 líneas por dominio de todos los dominios

tail -n 5000 /srv/log/httpd/access_log | awk '{print $1}' | sort | uniq -c |sort -n | tail

Últimas 5000 líneas por ip de todos los dominios

tail -n 5000 /srv/log/httpd/access_log | awk '{print $2}' | sort | uniq -c |sort -n | tail

Pseudotop con CPU solo de los procesos php

watch "ps -eo pid,user,%cpu,%mem,command --sort=-%cpu | grep '[p]hp-fpm'"

Conexiones a puertos 80|443

netstat -tlna | egrep ":80|:443" | awk {'print $5'} | cut -d ':' -f 1 | sort | uniq -c | sort -n | tail

Ataque a xmlrpc.php

cat  /srv/log/httpd/access_log | awk '{print $1" " $2 " " $8}' | grep xmlrpc.php | sort | uniq -c |sort -n | tail

Buscar errores 404|403

cat /srv/log/httpd/access_log | grep -E 'HTTP/2.0" (403|404)' | awk '{print $1, $2, $8, $10}' | sort | uniq -c | sort -n | tail -n 50

Reiniciar Apache + php-fpm + xymon

 systemctl restart php* httpd xymon 

Mysql