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 1: | Línea 1: | ||
[[Categoría: Linux]] | [[Categoría: Linux]] | ||
=== Apache=== | === '''Apache'''=== | ||
Últimas 5000 líneas por dominio de todos los dominios | Últimas 5000 líneas por dominio de todos los dominios | ||
<pre>tail -n 5000 /srv/log/httpd/access_log | awk '{print $1}' | sort | uniq -c |sort -n | tail</pre> | <pre>tail -n 5000 /srv/log/httpd/access_log | awk '{print $1}' | sort | uniq -c |sort -n | tail</pre> | ||
Últimas 5000 líneas por ip de todos los dominios | '''Últimas 5000 líneas por ip de todos los dominios''' | ||
<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> | ||
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> | ||
Ataque a xmlrpc.php | '''Ataque a xmlrpc.php''' | ||
<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 | |||
<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 | |||
<pre> systemctl restart php* httpd xymon </pre> | |||
===Mysql=== | ===Mysql=== | ||
Revisión del 07:43 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
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
