How to analyze Apache access.log with AWStats?

When i use VirtualSever in WanWang.com which provide the awstats report for administrator to help analyze the webserver`s visit status.In my case , I want a single static html file , easily to share πŸ™‚

First of all .you must change you awstats.model.conf correctly!

In my case , i change this.

LogFormat=1
# i change to 4 default is 1

LogFile="/var/log/httpd/mylog.log"
# change the path to you access.log file full path!

Then you can run the command below to generate the html report file!

$ cd awstats-7.7\wwwroot\cgi-bin
$ perl awstats.pl -config=model -output -staticlink >> youserver.html

When you access.log file include long duration of year.you can use sed command to extract the line you want to analyze!

$ sed -n '[start line number],[end line number]p' access.log >> access_sed.log

Conclusion:

Some images in the static html can`t show , so i will figure it out later.

for more detail pls visit

https://www.awstats.org/

use Fabric & GoAccess to generate website access report

Background:

I want to know the daily website(apache2/nginx etc.) access report,like some charts include the page view(PV) , IPs.

Part 1: install fabric and goaccess

  1. $ pip install fabric
  2. $ apt-get install goaccess (installation in other platform see https://goaccess.io/download)

Part 2: write down the code

#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
from fabric import Connection
import time
import os

# the host connection infomation , fill you infomation in []
c = Connection(
    host="[you host]",
    user="[username]",
    connect_kwargs={
       # key_filename": "[user private file]",
        "password": "[user_password]",
    }
)
# get the start time
current_time = time.time()
date_str = time.strftime('%Y_%m_%d',time.localtime(current_time))

# download the nginx log (access.1.log means yesterday`s access log)
c.get('/var/log/nginx/access.1.log'.format(date_str) , './access.{}.log'.format(date_str))

# run the goaccess and generate the report in html format
os.system("goaccess ./access.{}.log -o report.{}.html".format(date_str,date_str))

Finally you will see you daily report like the image below

from https://goaccess.io/features