Is it possible to produce a list or log of the bandwidth usage by file on NGINX? Something like:
BANDWIDTH USAGE LAST 7 DAYS by FILE;
\Project.zip 1.8 GB
\Docu8ment.doc 350 MB
\logo.png 238 MB
\style.css 72 MB
Is it possible to produce a list or log of the bandwidth usage by file on NGINX? Something like:
BANDWIDTH USAGE LAST 7 DAYS by FILE;
\Project.zip 1.8 GB
\Docu8ment.doc 350 MB
\logo.png 238 MB
\style.css 72 MB
Maybe something like this will work if you use it in a crontab ?
cd /rootDir/ for FILE in *; do
count=$(grep -c $FILE /var/log/nginx/access.log)
size=$(du $FILE | cut -f1)
BW4File=$((count * size))
echo $FILE $BW4File"K"
done
nginx produces access.log
files with common log format. Common log format files can be analysed with different utilities, for example Webalizer and AWStats.
Those can generate statistics that you are looking for.