Old 30th September 2013, 20:04   #1
wavuti
Junior Member
 
Join Date: Sep 2013
Posts: 1
HOW TO: Setting Up Log Analyzer for Your SHOUTcast Server

So I have been looking for a way to get analytics for several streams I host on my SHOUTcast server, based on the w3c logs generated by SHOUTcast DNAS Server 2. This would include historical stats like hourly listener numbers, daily listener numbers and how long they spent listening. Also possibly with some graphs. I did not have much luck. The few log parsers I could find, I could not get to work with my stream (both open source/Commercial) . These included:
  1. Radio Toolbox
  2. CasterStats
  3. SawMill
  4. Star Network's Log Parser

So with a little help from SQL Server and ASP.NET, ended up building one of my own and wanted to share. Hope this helps anyone out there interested,

All you will need is:
  1. SQL Server(Express will do)
  2. Visual Web Developer
  3. A copy of your W3C log file

Proceed to setup a new database in SQL Server. In it, we are going to create a table for importing the W3C log into. Here is one thing to note. As of this posting, SHOUTcast DNAS Server 2's W3C log format is as follows:

Quote:
#Fields: c-ip c-dns date time cs-uri-stem c-status cs(User-Agent) sc-bytes x-duration avgbandwidth
66.156.94.18 66.156.94.18 2002-09-14 22:38:34 /stream?title=Unknown 200 iTunes%2F3%2E0%20%28Macintosh%3B%20N%3B%20PPC%29 409600 86 38096
Thus, create table as follows:

Quote:
CREATE TABLE [dbo].[LOGS] (
[c-ip] [varchar] (50) NULL ,
[c-dns] [varchar] (50) NULL ,
[date] [datetime] NULL,
[time] [time] NULL ,
[cs-uri-stem] [varchar] (max) NULL ,
[c-status] [varchar] (max) NULL,
[cs(User-Agent)] [varchar] (max) NULL ,
[sc-bytes] [int] NULL,
[x-duration] [int] NULL,
[avgbandwidth] [int] NULL,
)
Finally, import the log into the table:

Quote:
BULK INSERT [dbo].[LOGS] FROM 'c:\SCLogs\yourstream_w3c.log'
WITH (
FIELDTERMINATOR = ' ',
ROWTERMINATOR = '\n'
)

All you have to do at this point, based on the kind of reports you want, is build web pages and charts using queries from this table.

Hope this helps.
wavuti is offline   Reply With Quote
Old 22nd October 2013, 12:08   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
might want to update it to support v2.2 (see top sticky threads) as there were some changes to the w3c log output from v2.0 to make it more compatible with the v1.x files.
DrO is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Discussions

Tags
analytics, analyzer, log, w3c

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump