Awstats mod for process Wowza Stats

Download the package from this link:

AWStats Mod for WowzaMediaServer (3269)
Awstats mod conf file (2168)

Add this lines into your Apache configuration:

#
# Directives to allow use of AWStats as a CGI
#

Alias /awstatsclasses /usr/local/awstats-wmc/wwwroot/classes/
Alias /awstatscss /usr/local/awstats-wmc/wwwroot/css/
Alias /awstatsicons /usr/local/awstats-wmc/wwwroot/icon/
ScriptAlias /awstats/ /usr/local/awstats-wmc/wwwroot/cgi-bin/

#
# This is to permit URL access to scripts/files in AWStats directory.
#

AddHandler cgi-script cgi pl
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all

Setting up the Crontab for update the Stats automatically

*/5 * * * * /usr/local/awstats-wmc/tools/awstats_updateall.pl now > /var/log/awstats.log

Setting up the Wowza Log Appender for save the information in the format then Awstats will be understand

For doit this edit the log4j.properties normally into this path:

 /usr/local/WowzaMediaServer/conf/log4j.properties 

Add this appender:

 # Statistics appender (to use this appender add "serverAWStats" to the list of appenders in the first line of this file)

log4j.appender.serverAWStats=org.apache.log4j.DailyRollingFileAppender
log4j.appender.serverAWStats.DatePattern='.'yyyy-MM-dd
log4j.appender.serverAWStats.File=${com.wowza.wms.ConfigHome}/logs/wmconsulting_stats.log
log4j.appender.serverAWStats.layout=com.wowza.wms.logging.ECLFPatternLayout
log4j.appender.serverAWStats.layout.Fields=date,time,c-proto,c-ip,c-referrer,x-status,cs-uri-stem,sc-bytes,x-duration,x-sname,sc-stream-bytes,cs-stream-bytes,x-ctx,c-proto,x-appinst
log4j.appender.serverAWStats.layout.OutputHeader=true
log4j.appender.serverAWStats.layout.QuoteFields=false
log4j.appender.serverAWStats.layout.Delimeter=tab
log4j.appender.serverAWStats.layout.EventInclude=destroy

This way the logs will rotate automatically every day, and you can move this logs to the stats server… of curse you will have 1 day of delay with the stats… if the Awstats is on the same server than Wowza, you can update the logs every five minutes or less depend of your needs…

Test your configuration running the command manually

First run:

/usr/local/awstats-wmc/wwwroot/cgi-bin/awstats.pl -config=your.site.com

Update run:

/usr/local/awstats-wmc/wwwroot/cgi-bin/awstats.pl -update -config=site.com  -showdropped

Real Time demo:

VOD Files
Live Streams

Here a few ScreenShots:

28 pensamientos sobre “Awstats mod for process Wowza Stats”

  1. This is a MOD of the official Awstats 7.0 this have added a few lines into the original code for support all the Wowza Protocols, and Live Stream. I’ll add to the post the ChangeLog…

  2. I’ve tried this but it shows no info at all. I mean, all the values in all the graphs show 0, even though my server is active and the logs are full. How can I troubleshoot that?

  3. Sorry, now I tried with the -update on command line. Though it drops all my lines! It says “Dropped record (virtual hostname ‘x-appinst’ does not match SiteDomain=’default’ nor HostAliases parameters)”.

  4. Yes sure, check the log4j.properties, and uncomment the last lines, where are activated Log by application. Bear on mind than the current Awstats configure file is for parse using Application Instance not Application. But only need adapt the line.

  5. Hello,

    I need some help on getting awstats process my media server logs. No matter what I try it seems to give some sort of the error.

    Here is a snippet of my actual log file
    ======================================
    #Version: 1.0

    #Start-Date: 2011-05-18 08:08:34

    #Date: 2011-05-18

    #Fields: x-category,x-event,date,time,x-pid,c-ip,c-client-id,c-proto,c-connect-type,x-sc-qos-bytes,s-uri,cs-bytes,sc-bytes,x-sname,cs-stream-bytes,sc-stream-bytes,x-file-size,x-file-length,x-status,x-cpu-load,x-mem-load,x-comment

    server,server-start,2011-05-18,08:08:34,9592,-,-,-,-,-,-,-,-,-,-,-,-,-,-,0,9,-

    vhost,vhost-start,2011-05-18,08:08:34,9592,-,-,-,-,-,-,-,-,-,-,-,-,-,-,0,9,-

    application,app-start,2011-05-18,08:08:34,9592,-,-,-,-,-,-,0,0,-,-,-,-,-,-,-,-,-

    session,connect-pending,2011-05-18,08:08:34,9592,111.93.43.226,4852751105844659010,rtmp,normal,-,”rtmp://117.211.85.227/video_module/NMEICT-AVIEW-TEST”,3073,3073,-,-,-,-,-,100,0,9,-

    session,connect,2011-05-18,08:08:34,9592,111.93.43.226,4852751105844659010,rtmp,normal,-,”rtmp://117.211.85.227/video_module/NMEICT-AVIEW-TEST”,3073,3073,-,-,-,-,-,200,0,9,-

    #Date: 2011-05-18

    #Fields: x-category,x-event,date,time,x-pid,c-ip,c-client-id,c-proto,c-connect-type,x-sc-qos-bytes,s-uri,cs-bytes,sc-bytes,x-sname,cs-stream-bytes,sc-stream-bytes,x-file-size,x-file-length,x-status,x-cpu-load,x-mem-load,x-comment

    server,server-start,2011-05-18,08:08:35,10136,-,-,-,-,-,-,-,-,-,-,-,-,-,-,0,9,-
    ======================================

    And here is what I have configured in the awstats.myserver.conf
    ======================================
    LogType=S
    LogFormat = “x-category,x-event,date,time,x-pid,c-ip,c-client-id,c-proto,c-connect-type,x-sc-qos-bytes,s-uri,cs-bytes,sc-bytes,x-sname,cs-stream-bytes,sc-stream-bytes,x-file-size,x-file-length,x-status,x-cpu-load,x-mem-load,x-comment”
    LogSeparator=”,”
    ======================================

    awstats.pl throws an error

    Error: Your personalized LogFormat does not include all fields required by AWStats (Add %host in your LogFormat string).

    I tried changing the LogFormat to

    LogFormat = “x-category,x-event,date,time,x-pid,%host,c-client-id,c-proto,c-connect-type,x-sc-qos-bytes,s-uri,cs-bytes,sc-bytes,x-sname,cs-stream-bytes,sc-stream-bytes,x-file-size,x-file-length,x-status,x-cpu-load,x-mem-load,x-comment”

    but still the same error. looks like the awstats.pl is not parsing properly. Can you please help.

  6. Hi there. Using the above conf file and its LogFormat configuration I cannot get browser and operating system stats. They are registered but as unknown. Can some one help on this issue? Thx in advance…


  7. schrill:

    Hi there. Using the above conf file and its LogFormat configuration I cannot get browser and operating system stats. They are registered but as unknown. Can some one help on this issue? Thx in advance…

    I’ve enabled user-agent in woowza but I don’t know with what parametar to parse the information to awstat so it can display it. Tried standard %ua and rest but they are simply to different in the encoding.

  8. Hi is there any form to use this excelent reports to a load balance server configuration? I actually have 4 servers with loadbalance config and I am looking for centralizated report…

    tks

  9. Luis,

    Please let me know with more details what do you need, you can write directly to my “use the form contact”… we are from Buenos Aires, Argentina… can write me in Spanish.
    Saludos, Alejandro

  10. Hello Alejandro, I’m getting the following error, can you guide me?

    Error: Plugin init for plugin ‘graphgooglechartapi’ failed with return code: Error: AWStats version 7.0 or higher is required. Detected 6.6 (build 1.887).

    Setup (‘/etc/awstats/awstats.domain.com.conf’ file, web server or permissions) may be wrong.
    Check config file, permissions and AWStats documentation (in ‘docs’ directory).

    Thanks, Jenny.

  11. Jeny,

    You are using older version of AWStats this mod was created based on Awstats 7.0 and you are using “6.6 (build 1.887)”.
    Regards,
    Alejandro

  12. Hi Alejandro, I’ve upgraded AWStats and not I don’t have that error, but when I open awstats on the browser, it’s always 0 on the visitors and other fields, even when I update using the command line.
    Also, when I hit update on the awstats interface, it gives the following error:
    Error: Command for pipe ‘/usr/local/awstats-wmc/tools/logresolvemerge.pl /usr/local/WowzaMediaServer/logs/*stats* |’ failed

    Setup (‘/etc/awstats/awstats.conf’ file, web server or permissions) may be wrong.
    Check config file, permissions and AWStats documentation (in ‘docs’ directory).

    The permissions are correct. If I run this command alone, it gives me a nice output:
    /usr/local/awstats-wmc/tools/logresolvemerge.pl /usr/local/WowzaMediaServer/logs/*stats*

    Cron is running fine as well, I’ve correct the command to include to awstats.pl file.

    Can you guide me on this one?

    Thanks in advance,
    Jenny

  13. Jenny,

    Remember than the Webserver can be run with other user than you are executing by Command Line, if you are using Apache can be use “httpd” or “apache” user, depend of your Linux OS, check from this side… let me know!

    Ale

  14. How can I configure this your awstats on windows? I already have it installed on Windows, working properly, how can I change that works with Wowza IN WINDOWS?

  15. Hi Alejandro ,

    I had followed the instruction, however, after I ran the commend perl awstats.pl -config=default, I got:

    PS C:\Program Files (x86)\awstats-wmc\awstats-wmc\wwwroot\cgi-bin> perl awstats.pl -config=default
    Create/Update database for config “./awstats.default.conf” by AWStats version 7.0 (build 1.971)
    From data in log file “C:\Program Files (x86)\Wowza Media Systems\Wowza Media Server 2.2.4\logs\wmconsulting_stats.log”.
    ..
    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: 11
    Found 7 dropped records,
    Found 4 comments,
    Found 0 blank records,
    Found 0 corrupted records,
    Found 0 old records,
    Found 0new qualified records.

    It drops 7 records, is there any thing wrong? What can I do? (I spent few days to google this matter but no progress at all)

    Please help!

  16. Really is not a plugin, is a Log Parser… and yes, works with Wowza3, I recommend this only for RTMP or RTSP, into the case of HTTP the way to get metrics is other and can brake the global metrics.

  17. Hi, look this error:

    Dropped record (method/protocol ‘rtmp’ not qualified when LogType=S): what is this ?

  18. Silas, you need use my modify version of AWStats, I have extended the protocols supported and RTMP is not included, but this is not by default into Awstats i’ll try to commit to the project fro come by default into the newest versions.

  19. While i’m testing i got this message

    Never updated (See ‘Build/Update’ on awstats_setup.html page)

    on manual update
    root@awstats:/usr/local/awstats-wmc/tools# /usr/local/awstats-wmc/wwwroot/cgi-bin/awstats.pl -config=192.168.1.131
    Create/Update database for config “/etc/awstats/awstats.conf” by AWStats version 7.0 (build 1.971)
    From data in log file “/usr/local/WowzaMediaServer/logs/wmconsulting_stats.log”…
    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: 8
    Found 0 dropped records,
    Found 5 comments,
    Found 0 blank records,
    Found 3 corrupted records,
    Found 0 old records,
    Found 0 new qualified records.
    root@awstats:/usr/local/awstats-wmc/tools# /usr/local/awstats-wmc/wwwroot/cgi-bin/awstats.pl -update -config=192.168.1.131 -showdropped
    Create/Update database for config “/etc/awstats/awstats.conf” by AWStats version 7.0 (build 1.971)
    From data in log file “/usr/local/WowzaMediaServer/logs/wmconsulting_stats.log”…
    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: 8
    Found 0 dropped records,
    Found 5 comments,
    Found 0 blank records,
    Found 3 corrupted records,
    Found 0 old records,
    Found 0 new qualified records.

    So.. how can i update my logs? actually i installed a plugin to webmin. also trying to parts wowza logs….

  20. Hi
    I followed all the treads I could and I cannot find the answer. I have this problem when running this command:
    perl awstats.pl -config=http://videostreamdev.sheridanc.on.ca/ -showdropped -update

    This is just to update …

    Parsed lines in file: 210
    Found 193 dropped records,
    Found 15 comments,
    Found 0 blank records,
    Found 0 corrupted records,
    Found 2 old records,
    Found 0 new qualified records.

    perl awstats.pl -config=http://videostreamdev.sheridanc.on.ca/ -showdropped -update

    This is my LogFormat:

    LogFormat=”date time %method c-ip %referer %code %url sc-bytes filelength x-sname sc-stream-bytes cs-stream-bytes cs-uri-stem %extra1″

    I am trying to find stats on how many users connect to a specific stream ( I have two).

    Please help

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *


*

Puedes usar las siguientes etiquetas y atributos HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>