Answer the question
In order to leave comments, you need to log in
How to parse nginx log to static?
You need to parse the nginx log and get all the file extensions that are requested
cat access.log | awk '{print $8}' | rev | cut -d'.' -f1 | rev | sort | uniq -c | sort -rn
881781 jpg
159161 png
96670 html
94454 webp
70508 js
68654 ico
55866 css
48728 jpeg
35943 1
27878 php
12441 htm
12270 2
9556 gif
6468 4-wp
6258 woff?12
5655 /?utm_source=adbless&utm_medium=cpm&utm_campaign=3126
5595 3
5528 /
5388 /?utm_source=onixz
4951 xml
4321 woff?13
4068 txt
Answer the question
In order to leave comments, you need to log in
just add the appropriate code that will parse the strings to see if they are extensions or not.
since you didn't specify which of these are extensions and which are not, I will rely on my experience.
for example like this:
cat access.log | awk '{print $8}' | rev | cut -d'.' -f1 | rev | perl -pe 's/\?.*//;s/^\/$//' | sort | uniq -c | sort -rn
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question