Script de generation de stats Awstats mensuelles
- Par: serveurblog
- Le: 17.03.2009 10:29:50
- Dans: Statistiques Web
Voici un petit script bien utilile pour generer des stats a partir de logs quotidiens sur IIS .
A adapter bien sur !
**********************************
nlect = "D:"
nRep = "D:\www"
ip="ip_de_votre_serveur"
annee=year(date()-1)
annee=right(annee,2)
mois=month(date()-1)
if mois<10 then mois="0"&mois *****************
domaine=inputbox("Saisir le nom de domaine sur lequel vous voulez generer les stats depuis le debut du mois - Ne pas mettre les www")
rep_logs=inputbox("Saisir le nom du repertoire de logs . exemple : W3SVC72")
msgbox("ATTENTION : Pour regenerer les stats du mois en cours pour ce domaine, le fichier awstats"&mois&"20"&annee&"."&domaine&".txt doit etre DES MAINTENANT supprimé ( il se trouve dans le repertoire cgi-bin du d:\www\ip_de_votre_serveur)")
ab=ab&"LogFile=d:\www\"&domaine&"\logs\"&rep_logs&"\"&jour&""&vbCrLf
ab=ab&"LogFormat= 2"&vbCrLf
ab=ab&"DNSLookup=1"&vbCrLf
ab=ab&"DirData=."&vbCrLf
ab=ab&"AllowToUpdateStatsFromBrowser=0"&vbCrLf
ab=ab&"AllowFullYearView=3"&vbCrLf
ab=ab&"PurgeLogFile=0"&vbCrLf
ab=ab&"ArchiveLogRecords=0"&vbCrLf
ab=ab&"DirCgi=/cgi-bin"&vbCrLf
ab=ab&"DirIcons=/icon"&vbCrLf
ab=ab&"SiteDomain=www."&domaine&""&vbCrLf
ab=ab&"HostAliases=www\.myserver\.com x\.y\.z\.w localhost 127\.0\.0\.1"&vbCrLf
ab=ab&"Lang=fr"&vbCrLf
ab=ab&"DirLang=/lang"&vbCrLf
ab=ab&"DefaultFile=index.php"&vbCrLf
ab=ab&"SkipHosts="&vbCrLf
ab=ab&"SkipDNSLookupFor="&vbCrLf
ab=ab&"SkipFiles=\.css$ \.js$ \.class$ robots\.txt$"&vbCrLf
ab=ab&"OnlyFiles="&vbCrLf
ab=ab&"WarningMessages=1"&vbCrLf
ab=ab&"Expires=0"&vbCrLf
ab=ab&"ShowFlagLinks=1"&vbCrLf
ab=ab&"ShowDomainsStats=PHB"&vbCrLf
ab=ab&"ShowLinksOnUrl=1"&vbCrLf
ab=ab&"URLWithQuery=1"&vbCrLf
ab=ab&"ShowPagesStats=PBEX"&vbCrLf
ab=ab&"IncludeInternalLinksInOriginSection=1"&vbCrLf
ab=ab&"ShowOriginStats=PH "&vbCrLf
ab=ab&"SplitSearchString=0"&vbCrLf
ab=ab&"HTMLEndSection="&vbCrLf
ab=ab&"BarWidth = 260"&vbCrLf
ab=ab&"BarHeight = 180"&vbCrLf
ab=ab&"MaxNbOfDomain = 25"&vbCrLf
ab=ab&"MaxNbOfHostsShown = 25"&vbCrLf
ab=ab&"MinHitHost = 1"&vbCrLf
ab=ab&"MaxNbOfRobotShown = 25"&vbCrLf
ab=ab&"MinHitRobot = 1"&vbCrLf
ab=ab&"MaxNbOfPageShown = 25"&vbCrLf
ab=ab&"MinHitFile = 1"&vbCrLf
ab=ab&"MaxNbOfRefererShown = 25"&vbCrLf
ab=ab&"MinHitRefer = 1"&vbCrLf
ab=ab&"MaxNbOfKeywordsShown = 25"&vbCrLf
ab=ab&"MinHitKeyword = 1"&vbCrLf
ab=ab&"Logo=haut_02.jpg"&vbCrLf
ab=ab&"LogoLink=http://www.jalis.fr"&vbCrLf
ab=ab&"color_Background=FFFFFF # Background color for main page (Default = FFFFFF)"&vbCrLf
ab=ab&"color_TableBGTitle=CCCCDD # Background color for table title (Default = CCCCDD)"&vbCrLf
ab=ab&"color_TableTitle=000000 # Table title font color (Default = 000000)"&vbCrLf
ab=ab&"color_TableBG=CCCCDD # Background color for table (Default = CCCCDD)"&vbCrLf
ab=ab&"color_TableRowTitle=FFFFFF # Table row title font color (Default = FFFFFF)"&vbCrLf
ab=ab&"color_TableBGRowTitle=ECECEC # Background color for row title (Default = ECECEC)"&vbCrLf
ab=ab&"color_TableBorder=ECECEC # Table border color (Default = ECECEC)"&vbCrLf
ab=ab&"color_text=000000 # Color of main body text (Default = 000000)"&vbCrLf
ab=ab&"color_titletext=000000 # Color of text title within colored Title Rows (Default = 000000)"&vbCrLf
ab=ab&"color_weekend=EAEAEA # Color for week-end days"&vbCrLf
ab=ab&"color_link=0011BB # Color of HTML links (Default = 0011BB)"&vbCrLf
ab=ab&"color_hover=605040 # Color of HTML on-mouseover links (Default = 605040) "&vbCrLf
ab=ab&"color_v=F3F300 # Background color for number of visites (Default = F3F300)"&vbCrLf
ab=ab&"color_w=FF9933 # Background color for number of unique visitors (Default = FF9933)"&vbCrLf
ab=ab&"color_p=4477DD # Background color for number of pages (Default = 4477DD)"&vbCrLf
ab=ab&"color_h=66F0FF # Background color for number of hits (Default = 66F0FF)"&vbCrLf
ab=ab&"color_k=339944 # Background color for number of bytes (Default = 339944)"&vbCrLf
ab=ab&"color_s=8888DD # Background color for number of search (Default = 8888DD)"&vbCrLf
Set genere = CreateObject("Scripting.FileSystemObject")
fichier="D:\www\"&ip&"\cgi-bin\awstats."&domaine&".conf"
Set creation = genere.CreateTextFile(fichier,true)
creation.WriteLine(ab)
creation.close
ab=""
chemin_webalizer="D:\www\"&ip&"\cgi-bin"
for i=1 to 31
jour=i
if i<10 then jour="0"&i
madate=annee&mois&jour
fichierdate="ex"&madate&".log"
commande=chemin_webalizer & "\awstats.pl -config="&domaine&" -update -configdir=D:\www\"&ip&"\cgi-bin -LogFile=d:\www\"&domaine&"\logs\"&rep_logs&"\"&fichierdate&vbCrLf
fincommande=fincommande&commande
next
Set genere = CreateObject("Scripting.FileSystemObject")
fichier="c:\server\begin_month.bat"
Set creation = genere.CreateTextFile(fichier,true)
creation.WriteLine(fincommande)
creation.close
set ColRep = nothing
set MonRep = nothing
set fs = nothing
Set W = CreateObject("WScript.Shell")
W.RUN fichier
Comment purger et supprimer les logs ?
- Par: serveurblog
- Le: 24.12.2008 09:45:18
- Dans: Statistiques Web
Il faut regulierement ( dès qu'au moins 1 fichier log depasse 200 ou 300 mo ) , purger les logs de IIS .
La procedure :
1) Arreter IIS ( net stop w3svc )
2) ouvrir le poste de travail
3) se placr dans d:\www\
4) Appuyer sur F3 ( rechercher )
5) Dans la zone rechercher mette : extend1.log et cliquez sur rechercher
6) Quand la recherche est terminée, Faire Control + A dans la colonne de droite
7) Supprimez et confirmez
8) relancez IIS ( net start w3svc )
Script bat ou VBS de mise a jour de statistiques
- Par: serveurblog
- Le: 30.03.2008 11:21:35
- Dans: Statistiques Web
- Commentaires: 0
Voici un script VBS qui vous permettra de mettre a jour vos statistiques Webalizer :
nlect = "D:"
nRep = "D:\www"
dim tab_(200,2)
set fs = CreateObject("Scripting.FileSystemObject")
set MonRep = fs.GetFolder(nRep)
set ColRep = MonRep.SubFolders
i=0
for each folderItem in ColRep
tab_(i,1)=folderItem.name
i=i+1
next
for j=0 to i-1
nRep = nlect&"\www\"&tab_(j,1)&"\logs"
set MonRep = fs.GetFolder(nRep)
set ColRep = MonRep.SubFolders
for each folderItem in ColRep
tab_(j,2)=folderItem.path
next
next
chemin_webalizer="C:\server\stats\webalizer"
titre="Statistiques Webalizer pour : "
nombre_ligne=10
dir="cd C:\server\stats\"&vbCrLf
for j=0 to i-1
commande=chemin_webalizer & " -q -P asp* -P htm* -P php* -F iis -t " & chr(34)&titre& chr(34)& " -n " & tab_(j,1) & " -l " &nombre_ligne & " -o "&nlect&"\www\"&tab_(j,1)&"\website\stats "&tab_(j,2)&"\extend1.log"&vbCrLf
fincommande=fincommande&commande
nextSet genere = CreateObject("Scripting.FileSystemObject")
fichier="c:\server\lancewebalizer"&ip&".bat"
Set creation = genere.CreateTextFile(fichier,true)
creation.WriteLine(dir&fincommande)
creation.close
set ColRep = nothing
set MonRep = nothing
set fs = nothing
Set W = CreateObject("WScript.Shell")
W.RUN fichier
Les statistiques Webalizer ne se mettent pas a jour .
- Par: serveurblog
- Le: 30.03.2008 11:19:30
- Dans: Statistiques Web
- Commentaires: 0
Dans ca cas, controler que :
- Le repertoire /stats existe dans le repertoire de base .
- Le dossier de logs /logs ne contient qu'un seul repertoire .
- Le lancement de Webalizer se fait bien avec les bons attributs