Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 17/12/2022, à 20:44

thpo

[résolu] Awstats et ajout des logs archivés

Bonjour,

J'ai Ubuntu 18.04.6 LTS, j'essaye de mettre en place Awstats pour voir l'activité du serveur. J'y suis parvenu sauf pour la récupération des logs archivés.

J'ai suivi la procédure de la doc, mais ça ne marche pas comme prévu

https://doc.ubuntu-fr.org/awstats#ajout … s_archives

Tout d'abord ça semble réussir

...
Fichier traité: access.public.log.4.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 3
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 3 new qualified records.
Fichier traité: access.public.log.3.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 384
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 384 new qualified records.
Fichier traité: access.public.log.2.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 1564
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 8 corrupted records,
 Found 0 old records,
 Found 1556 new qualified records.

Mais les fichiers n'apparaissent pas dans le dossier comme prévu :

user@pc:/var/lib/awstats# ls -la
total 24
drwxr-x---  2 www-data www-data 4096 déc.  17 19:31 .
drwxr-xr-x 80 root     root     4096 déc.  14 18:38 ..
-rw-r--r--  1 root     root     9981 déc.  17 19:31 awstats122022.public.txt
-rw-r--r--  1 root     root      844 déc.  17 19:31 dnscachelastupdate.public.hash
user@pc:/var/lib/awstats# 

Merci par avance pour votre aide

Dernière modification par thpo (Le 19/12/2022, à 21:39)

Hors ligne

#2 Le 18/12/2022, à 12:29

gl38

Re : [résolu] Awstats et ajout des logs archivés

Tu as déjà le fichier awstats122022.public.txt qui doit contenir des données chiffrées sur les accès à ton serveur.
Ce serait évidemment plus agréable d'avoir un joli fichier html.

Dans ton premier rapport, il manque le début et la fin, est-ce que tu n'aurais pas enlevé le contenu du fichier html ?
Chez moi il y a une redirection ">gl38.html", peux-tu ajouter quelque chose de ce genre à la ligne de commande qui lance awstats.pl ?

Je ne comprends pas pourquoi il y a du sudo dans la doc. J'utilise directement ce qui est fourni par awstats et franchement c'est assez compliqué comme ça pour ne pas avoir envie d’abîmer ma config !
Cordialement,
Guy

Hors ligne

#3 Le 18/12/2022, à 14:51

thpo

Re : [résolu] Awstats et ajout des logs archivés

Merci pour votre message

J'ai suivi la doc, il est écrit que je devrais avoir un fichier par mois, hors je n'ai que le mois de décembre.
L'affichage en html fonctionne dans mon navigateur, Awstats doit utiliser le fichier txt pour faire un affichage html.

J'ai été obligé d'utiliser sudo, je suppose que c'est pour pouvoir créer les fichiers dans le dossier /var/lib/awstats
Peut-être qu'en changeant les droits de ce dossier ça passerait sans sudo.

Pour le script c'est celui-ci qui est indiqué dans la doc Ubuntu :

cd /var/lib/awstats
rm *
cd /var/log/apache*
for i in `ls -tr access.log.*.gz` 
do
 echo "Fichier traité: $i"
 zcat $i | /usr/lib/cgi-bin/awstats.pl -config=ma_machine_mon_domaine.com -update -LogFile=-
done

Je l'ai personnalisé et il semble fonctionner, sauf qu'au final je n'ai que décembre.

Hors ligne

#4 Le 18/12/2022, à 15:11

gl38

Re : [résolu] Awstats et ajout des logs archivés

Ma commande a plusieurs arguments de plus pour awstats.pl

./awstats.pl -month=all -year=all -output -update -config=gl38  >gl38.html

et dans mon dossier il y a des gl38.txt depuis 08/2016, et sur internet le fichier html commence en décembre 2011 !
Évidemment il y a eu des changements de système chez moi, et sur le serveur distant, plus des changements de version d'awstats. C'est assez miraculeux que ça marche aussi longtemps !
Cordialement,
Guy

Hors ligne

#5 Le 18/12/2022, à 17:15

bruno

Re : [résolu] Awstats et ajout des logs archivés

Bonjour,

Il y un script fourni avec Awstats pour faire cela :
https://www.awstats.org/docs/awstats_faq.html#MULTILOG

Celui de la doc a plein de défauts : des cd, un for… ls, un rm *, etc.

En admettant que les logs soir dans le dossier par défaut /var/log/apache2

for i in /var/log/apache2/access.log.*.gz
do
 echo "Fichier traité: $i"
 zcat $i | /usr/lib/cgi-bin/awstats.pl -config=ma_machine_mon_domaine.com -update -LogFile=-
done

mais cela ne traitera que le fichiers compressés (access.log.1 sera ignoré)

En utilisant le script indiqué dans la FAQ :

 /usr/lib/cgi-bin/awstats.pl -config=ma_machine_mon_domaine.com -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.log* |"

N.B. : rien de ceci n'a été testé, je n'ai pas utilisé Awstats depuis fort longtemps.

Hors ligne

#6 Le 19/12/2022, à 13:36

thpo

Re : [résolu] Awstats et ajout des logs archivés

Au cas où ça apporte quelquechose, voici le résultat complet de la commande de la doc Ubuntu

user@pc:$ sudo ./log_archive_awstats.sh 
rm: impossible de supprimer '*': Aucun fichier ou dossier de ce type
Fichier traité: access.public.log.14.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 3
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 3 new qualified records.
Fichier traité: access.public.log.13.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 40
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 40 new qualified records.
Fichier traité: access.public.log.12.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 38
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 38 new qualified records.
Fichier traité: access.public.log.11.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 55
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 55 new qualified records.
Fichier traité: access.public.log.10.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 20
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 1 corrupted records,
 Found 0 old records,
 Found 19 new qualified records.
Fichier traité: access.public.log.9.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 2
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 2 new qualified records.
Fichier traité: access.public.log.8.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 19
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 19 new qualified records.
Fichier traité: access.public.log.7.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 363
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 363 new qualified records.
Fichier traité: access.public.log.6.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 3
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 3 new qualified records.
Fichier traité: access.public.log.5.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 384
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 384 new qualified records.
Fichier traité: access.public.log.4.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 1564
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 8 corrupted records,
 Found 0 old records,
 Found 1556 new qualified records.
Fichier traité: access.public.log.3.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 1162
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 1 corrupted records,
 Found 0 old records,
 Found 1161 new qualified records.
Fichier traité: access.public.log.2.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 229
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 229 new qualified records.
user@pc:$ 

Et toujours pas de données pour les mois précédents

user@pc:/var/lib/awstats# ls -la
total 24
drwxr-x---  2 www-data www-data  4096 déc.  19 12:30 .
drwxr-xr-x 80 root     root      4096 déc.  14 18:38 ..
-rw-r--r--  1 root     root     10335 déc.  19 12:30 awstats122022.public.txt
-rw-r--r--  1 root     root       898 déc.  19 12:30 dnscachelastupdate.public.hash

Hors ligne

#7 Le 19/12/2022, à 13:51

bruno

Re : [résolu] Awstats et ajout des logs archivés

J'ai indiqué que le script de la doc était pourri. Tu as du bol que cette ligne :

rm *

lancée en root ne fasse pas plus de dégâts.

Si quelqu'un veut bien tester les commandes que j'ai données en #5, je corrigerai la doc en conséquence.

Hors ligne

#8 Le 19/12/2022, à 14:32

thpo

Re : [résolu] Awstats et ajout des logs archivés

Voilà le résultat sans sudo

user@pc:~$ ./log_archive_awstats_2.sh 
Fichier traité: /var/log/apache2/access.public.log.10.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.11.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.12.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.13.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.14.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.2.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.3.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.4.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.5.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.6.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.7.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.8.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
Fichier traité: /var/log/apache2/access.public.log.9.gz
Error: Failed to open directory /var/lib/awstats : Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
user@pc:~$ 

Et avec sudo :

user@pc:~$ sudo ./log_archive_awstats_2.sh 
[sudo] Mot de passe de user : 
Fichier traité: /var/log/apache2/access.public.log.10.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 20
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 1 corrupted records,
 Found 19 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.11.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 55
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 55 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.12.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 38
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 38 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.13.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 40
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 40 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.14.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 3
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 3 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.2.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 229
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 229 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.3.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 1162
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 1 corrupted records,
 Found 1161 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.4.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 1564
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 8 corrupted records,
 Found 1556 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.5.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 384
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 384 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.6.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 3
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 3 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.7.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 363
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 363 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.8.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 19
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 19 old records,
 Found 0 new qualified records.
Fichier traité: /var/log/apache2/access.public.log.9.gz
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "-"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 2
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 2 old records,
 Found 0 new qualified records.
user@pc:~$ 

Ca ne me donne toujours pas les anciens logs dans Awstats

Hors ligne

#9 Le 19/12/2022, à 15:37

bruno

Re : [résolu] Awstats et ajout des logs archivés

Les fichiers de logs sont bien traités mais je te conseille d'utiliser plutôt cette commande (à adapter à ton cas) :

 /usr/lib/cgi-bin/awstats.pl -config=ma_machine_mon_domaine.com -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.log* |"

Il faudrait voir le fichier de configuration et je me demande si c'est normal que /var/lib/awstats appartienne à root

Hors ligne

#10 Le 19/12/2022, à 17:38

thpo

Re : [résolu] Awstats et ajout des logs archivés

Merci pour votre aide.
Voici l'essai avec la nouvelle commande :

/usr/lib/cgi-bin/awstats.pl -config=public -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"
user@pc:~$ /usr/lib/cgi-bin/awstats.pl -config=public -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Error: Couldn't open file "/var/lib/awstats/awstats122022.public.tmp.18840" for write: Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
user@pc:~$ sudo /usr/lib/cgi-bin/awstats.pl -config=public -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"...
Phase 1 : First bypass old records, searching new record...
Direct access to last remembered record has fallen on another record.
So searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 4104
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 10 corrupted records,
 Found 4069 old records,
 Found 25 new qualified records.
user@pc:~$ 

Cette fois il y a bien un nouveau fichier dans le dossier, mais dans le navigateur rien de nouveau toujours seulement décembre.

user@pc:/var/lib/awstats# ls -la
drwxrwxr--  2 www-data www-data  4096 déc.  19 16:25 .
drwxr-xr-x 80 root     root      4096 déc.  14 18:38 ..
-rw-r--r--  1 root     root     10320 déc.  19 16:24 awstats122022.public.tmp.18835
-rw-r--r--  1 root     root     10353 déc.  19 16:25 awstats122022.public.txt
-rw-r--r--  1 root     root       898 déc.  19 16:25 dnscachelastupdate.public.hash
user@pc:/var/lib/awstats# 

Dernière modification par thpo (Le 19/12/2022, à 17:49)

Hors ligne

#11 Le 19/12/2022, à 18:16

bruno

Re : [résolu] Awstats et ajout des logs archivés

Je ne sais pas pourquoi les anciens logs ne sont pas pris en compte. À chaque passage ils semblent être déjà enregistrés (old records) :

Found 4069 old records,

Je suggère de déplacer le dossier de données :

sudo mv /var/lib/awstats /var/lib/awstats.save

puis le recréer avec les bon droits :

sudo mkdir /var/lib/awstats
sudo chown www-data:www-data /var/lib/awstats

et de relancer la commande que j'ai donné.

Hors ligne

#12 Le 19/12/2022, à 18:48

thpo

Re : [résolu] Awstats et ajout des logs archivés

C'est fait, et maintenant ça donne ça :

user@pc:~$ /usr/lib/cgi-bin/awstats.pl -config=public -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Error: Couldn't open file "/var/lib/awstats/awstats122022.public.tmp.19278" for write: Permission denied
Setup ('/etc/awstats/awstats.public.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
user@pc:~$ 

Avec sudo

user@pc:~$ sudo /usr/lib/cgi-bin/awstats.pl -config=public -update -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"
[sudo] Mot de passe de clubinfo : 
Create/Update database for config "/etc/awstats/awstats.public.conf" by AWStats version 7.6 (build 20161204)
From data in log file "/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.public.log* |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 4114
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 10 corrupted records,
 Found 0 old records,
 Found 4104 new qualified records.
user@pc:~$ 
root@pc:/var/lib/awstats# ls -la
total 24
drwxr-xr-x  2 www-data www-data  4096 déc.  19 17:45 .
drwxr-xr-x 81 root     root      4096 déc.  19 17:41 ..
-rw-r--r--  1 root     root     10497 déc.  19 17:45 awstats122022.public.txt
-rw-r--r--  1 root     root       898 déc.  19 17:45 dnscachelastupdate.public.hash
root@pc:/var/lib/awstats# 

Hors ligne

#13 Le 19/12/2022, à 19:03

bruno

Re : [résolu] Awstats et ajout des logs archivés

Ok donc tout a bien été pris en compte :

Found 4104 new qualified records.

Et désolé, j'avais zappé cela :

Cette fois il y a bien un nouveau fichier dans le dossier, mais dans le navigateur rien de nouveau toujours seulement décembre.

D'après les précédents retours on voit que seuls les fichiers :

/var/log/apache2/access.public.log.2.gz
…
/var/log/apache2/access.public.log.12.gz

sont présents et traités.
Tu n'as pas plus de 14 jours d'anciens logs, ce qui correspond à la configuration par défaut de logrotate pour Apache il me semble. Inutile donc de chercher des logs plus anciens que décembre.

Dernière modification par bruno (Le 19/12/2022, à 19:04)

Hors ligne