Overview
This article describes how to analyze Alibaba Cloud Content Delivery Network access logs in a Linux environment.
Background information
- Log on to the Alibaba Cloud Content Delivery Network console and download log files. For more information about log fields, see Log download.
- Upload log files to the local Linux server.
- Log on to the local Linux server, execute the following command, query all records with 200 status and output them to the specified file.
grep -w "200" [$Log_Txt] |awk '{if($9=="206") print $0}' > 200log.txt
Note :[$Log_Txt] is the downloaded log file.
- Execute the following command to retrieve a column in the file.
cat [$Log_Txt] |awk '{print $12}'
- Run the following command to calculate the response size in the log:
cat [$Log_Txt] |awk 'BEGIN {size=0} {size=size+$11} END{print "endsizeis",size/1024/1024,"M"} '
- Run the following command to query the top 10 IP page view:
cat [$Log_Txt] | awk '{print $3}' |sort|uniq -c|sort -nr |head -10
Application scope
- CDN