Last active
May 25, 2020 02:59
-
-
Save peerasan/675a7860991dac6b242d643e672abb0d to your computer and use it in GitHub Desktop.
nginx log HIT and MISS status
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 '{print $3}' /var/log/nginx/domain.cache.log | sort | uniq -c | sort -r | |
| #OUTPUT | |
| 132960 HIT | |
| 33117 MISS |
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
| log_format rt_cache '$remote_addr - $upstream_cache_status [$time_local] ' | |
| '"$request" $status $body_bytes_sent ' | |
| '"$http_referer" "$http_user_agent"'; | |
| server { | |
| access_log /var/log/nginx/domain.cache.log rt_cache; | |
| } | |
| # OUTPUT domain.cache.log | |
| # xxx.xxx.xxx.xxx - HIT [25/May/2020:07:13:49 +0700] "GET /mediacache/........." | |
| # xxx.xxx.xxx.xx - MISS [25/May/2020:07:13:49 +0700] "GET /mediacache/........." | |
| # xxx.xx.xxx.xxx - HIT [25/May/2020:07:13:49 +0700] "GET /mediacache/........." | |
| # xxx.x.xxx.xxx - MISS [25/May/2020:07:13:49 +0700] "GET /mediacache/........." | |
| # xxx.xx.xx.x - HIT [25/May/2020:07:13:49 +0700] "GET /mediacache/........." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment