linux查看log日志在哪,如何查看linux的系统log日志

时间:2025-03-27 06:59:01

1.查看系统日志所存放的位置

通过nginx的配置文件查看 default 。

access_log /var/log/nginx/ common;

2.查看系统日志的格式

通过nginx的配置文件查看 。(如果是apache,对应找到httpd文件)

log_format apinpai '$remote_addr $host - [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"';

3.通过命令进入日志

cd /var/log/nginx/

4.查看日志 访问前十的 信息

cat | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11}' | sort | uniq -c | sort -nr | head -10cat

| awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11}' | sort | uniq -c | sort -nr | head -10