Created
January 31, 2024 06:43
-
-
Save iflamed/d1836385442685e364cf6deeeeca9b0c to your computer and use it in GitHub Desktop.
使用awk 分析nginx日志
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk -F\" '{print $2}' access.log | awk '{print $2}' | awk -F\? '{print $1}' | sort -n | uniq -c | sort -rn | head -n 100 |
分割后的 sort, uniq 等操作则是获取 top 100 的数据。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用 awk 把文件的每行文本进行分割,使用-F指定分隔符,注意转移。