Linux commands (combat)

1. Find the IP with the most nginx access requests

 

cat /opt/logs/nginx/access.log | awk '{print $1}' | sort | uniq -c |sort -rn | more

 

2. Print the status code of each request

 

cat /opt/logs/nginx/access.log | awk '{pring $9}'

 

cat /opt/logs/nginx/access.log | grep  -ioE "HTTP\/1\.[1|0]\"[[:blank:]][0-9]{3}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326445221&siteId=291194637