Changes between Initial Version and Version 1 of PiwikImportScript


Ignore:
Timestamp:
07/02/13 14:33:56 (3 years ago)
Author:
chris
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PiwikImportScript

    v1 v1  
     1See PiwikServer#ServerLogAnalytics 
     2 
     3{{{ 
     4#!/bin/bash 
     5 
     6# date format used in log files names 
     7DATE=$(date "+%Y-%m-%d") 
     8 
     9# location of the latest log file 
     10NEW_LOG="/home/puffin/nginx/puffin-nginx-$DATE.log" 
     11 
     12LOGFILE="/home/puffin/nginx/puffin-nginx.log" 
     13 
     14# check the log file exists and then fix it 
     15# and import it to piwik 
     16if [[ -f $NEW_LOG ]]; then 
     17 
     18  # fix the issue with the proxy ip address being added to the first field 
     19  cat $NEW_LOG | sed 's/, 127.0.0.1//' > $LOGFILE 
     20 
     21  # import the fixed log file 
     22  python /web/stats.transitionnetwork.org/piwik/misc/log-analytics/import_logs.py \ 
     23         --url=https://stats.transitionnetwork.org/ \ 
     24         --idsite=12 --enable-static --enable-bots --enable-http-errors --enable-http-redirect \ 
     25         --log-format-regex='"(?P<ip>\S+)" (?P<host>\S+) \[(?P<date>.*?) (?P<timezone>.*?)\] (?P<status>\S+) (?P<length>\S+) \S+ \S+ "(?P<referrer>.*?)" "(?P<user_agent>.*?)" \S+ "\S+"' \ 
     26         --recorders=8 $LOGFILE 
     27 
     28fi 
     29}}}