[icecast] Parsing the icecast stats log

Gregory J.Grubbs greg at hoochiepep.com
Wed Oct 30 12:19:46 PST 2002


Hello All,

I wrote a PHP function to parse the icecast stats log and return as much information in a structured array as possible (well, as much as I care about, anyway).  Because the stats log is not easily machine-parseable, I thought this might be useful to somebody.  The log is parsed using Perl-compatible regexps, so it should easily port.

I have only my own setup to test this on, so I'm sure it will break on different setups.  My setup is icecast 1.3.12 on Linux, using the ices from CVS on September 18, 2002.  

The function get_icecast_stats() is included in the attached file icecastlog.inc, and sample output is included icecast_stats.txt (simply a print_r of the returned result).  You will only need to set the value of $iceroot to allow the function to find the stats log.

My icecast server is not public, so don't worry about unmodified URLs in the sample output!

-Gregory J. Grubbs

<p>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icecastlog.inc
Type: application/octet-stream
Size: 3438 bytes
Desc: icecastlog.inc
Url : http://lists.xiph.org/pipermail/icecast/attachments/20021030/b2f082e1/icecastlog.obj
-------------- next part --------------
The canonical megillah:

Array
(
    [sources] => Array
        (
            [source_id] => Array
                (
                    [0] => 0
                    [1] => 1
                    [2] => 2
                )

            [num_clients] => Array
                (
                    [0] => 2
                    [1] => 0
                    [2] => 0
                )

            [stream_title] => Array
                (
                    [0] => Radio blabla - Alison Krauss + Union Station - Stars
                    [1] => Radio blabla - Mark O'Connor - The Ballad of Sally Anne
                    [2] => Radio blabla - David Grisman - John Johanna w-Mike Seeger
                )

            [stream_url] => Array
                (
                    [0] => http://yp.icecast.org	x-audiocast-name: Madjic
                    [1] => http://yp.icecast.org	x-audiocast-name: Madjic
                    [2] => http://yp.icecast.org	x-audiocast-name: Madjic Channel 3
                )

            [genre] => Array
                (
                    [0] => variety
                    [1] => variety
                    [2] => lowband
                )

            [bitrate] => Array
                (
                    [0] => 128
                    [1] => 128
                    [2] => 64
                )

            [url] => Array
                (
                    [0] => http://frosty/
                    [1] => http://frosty/
                    [2] => http://frosty/
                )

            [mount] => Array
                (
                    [0] => /stream1
                    [1] => /stream2
                    [2] => /stream3
                )

            [description] => Array
                (
                    [0] => Streaming for Madjic Home
                    [1] => Streaming for Madjic Home
                    [2] => Streaming for Madjic Home - Internet channel
                )

            [public_flag] => Array
                (
                    [0] => 0
                    [1] => 0
                    [2] => 0
                )

        )

    [clients] => Array
        (
            [0] => Array
                (
                    [client_id] => 3262
                    [host] => zot
                    [user_agent] => Wget
                    [source_id] => 0
                )

            [1] => Array
                (
                    [client_id] => 3305
                    [host] => frosty
                    [user_agent] => mpg123/0.59s-mh4
                    [source_id] => 0
                )

        )

)

elapsed: 0.0040249824523926 seconds.
There are 2 clients connected
Client id 3262 is connecting from zot using Wget
Client id 3305 is connecting from frosty using mpg123/0.59s-mh4



More information about the Icecast mailing list