Error while importing with import_logs.py


#1

Hi there !

I set up my new piwik version, everything is running fine, but from now, I would like to use a bash for importation !

Here’s my script


##############################################################################
##############################################################################
######################### Création du script de log ##########################
##############################################################################
##############################################################################

# Arrêt du serveur Apache | Traitement des logs (English version : Apache2 stop | Log processing)

service apache2 stop

# Copie des anciens logs (English version : Older logs copy)

cp /var/log/apache2/access.log /var/log/backup_logs/
cp /var/log/apache2/access.log.* /var/log/backup_logs/
cp /var/log/apache2/access.log.*.gz /var/log/backup_logs/

# Importation des logs dans Piwik | concerne Owncloud (English version : Log Import to Piwik | For Owncloud )

python /var/www/piwik/misc/log-analytics/import_logs.py --idsite=3 --url=http://mywebsite/piwik --output=/var/log/apache2/test.log /var/log/apache2/access.*

# Déplacement des logs vers un répértoire de backup (English version : Move older logs to backup folder | Commented)

#mv /var/log/apache2/other_vhosts_access.log.old /var/log/backup_logs/other_vhosts_access.log.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.1.old /var/log/backup_logs/other_vhosts_access.log.1.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.2.old /var/log/backup_logs/other_vhosts_access.log.2.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.3.old /var/log/backup_logs/other_vhosts_access.log.3.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.4.old /var/log/backup_logs/other_vhosts_access.log.4.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.5.old /var/log/backup_logs/other_vhosts_access.log.5.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.6.old /var/log/backup_logs/other_vhosts_access.log.6.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.7.old /var/log/backup_logs/other_vhosts_access.log.7.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.8.old /var/log/backup_logs/other_vhosts_access.log.8.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.9.old /var/log/backup_logs/other_vhosts_access.log.9.old.bkp
#mv /var/log/apache2/other_vhosts_access.log.10.old /var/log/backup_logs/other_vhosts_access.log.10.old.bkp

# Fin des opérations | Ecriture dans un fichier pour vérifier que tout c'est bien passé (Process ending | Writing in a file for check purposes)

echo "L'importation c'est bien déroulée le $(date)" >> /var/log/import_piwik_success.log

#Redémarrage du serveur web (Web server restart)
service apache2 restart

When I try to execute my script, it process too fast, then I check the log, and I have this error : [Errno 111] Connection refused.

I checked on differents topics, it seems URL related but, I tried with the www version, and when I do the import_logs.py It work with http://mywebsite.fr/piwik

So thanks in advance for your help

Best regards,

EpicFrench


(Matthieu Aubry) #2

So it works with www and it does not without www ?


#3

Hi Matt,

Whenever I use the python /path/to/piwik/import_logs.py outside my script file which is in .sh it works with or without the www.site.fr/piwik | but when I try to execute my script I do the exact same command and it does not work.

I check in my logs and they said [Errno 111 Connection refused]

I tried with chmod but didn’t work either.

Thanks in advance.

Best regards,

EpicFrench


(Matthieu Aubry) #4

when I try to execute my script I do the exact same command and it does not work.
I check in my logs and they said [Errno 111 Connection refused]

what is your script, and how do you run it?


#5

what python version are you using? If its under 2.7.1 i would update it.