Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Show Streaming Radio logs
This guide concerns the listening information of Streaming Radio that can be exported using the FTP protocol; these logs (from which the listening statistics are also derived after “cleaning” or “purification”) are then automatically transferred by FTP to be processed afterward.
Preamble
- The logs of your radio will be provided in the form of a compressed file xyz.mp3-20140805.log.gz (the log date is in the format YYYYMMDD).
- Each log starts at 04:00 Swiss time and ends at 03:59:59 the next day.
- The log is in the form
ip user-identifier authuser [date-time] "request" status octets "referer" "useragent" listening-tim
e:81.56.215.98 - - [09/Apr/2019:08:23:18 +0200] "GET /toto.mp3 HTTP/1.1" 200 1211297 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2019032711 Ubuntu/8.10 (intrepid) Firefox/3.0.8" 69
- It may happen that the log line is malformed, due to a referer that is too long, for example; this behavior of Icecast cannot be modified.
- The IP addresses in the range 84.16.67.128/25 must be ignored as they are the streaming servers.
- From the settings page on the Manager, you can request the logs of past days.
- You can also directly export them to ACPM or Mediapulse.
Enable FTP log sending
To do this:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the product concerned.
- Click on the name of the audio stream concerned.
- Click on Settings in the left sidebar.
- Enable FTP log export with the toggle switch.
- Enter a hostname: server address.
- Enter a username: FTP account name.
- Enter a password: that of the FTP account.
- Enter the directory on the server in which to store the logs.
- Click the Save button at the bottom of the page:
Handle logs
The best is to use a regular expression like the one below:
"/^(\S+)\s(.+)\s(\S+)?\s\[((\d\d)\/([a-zA-Z]{3,3})\/(\d\d\d\d)\:(\d\d)\:(\d\d)\:(\d\d)\s\+\d\d\d\d)\]\s"GET\s\/([\-a-z0-9]{1,40}(\.)?(mp3|aac|ogg){0,1})(.*)?"\s(\d{3,3})\s(\d+)\s"(.+)"\s"(.+)"\s(\d+)$/i";
This syntax is that of the PHP function preg_match
and will need to be adapted if other functions/languages are used.
The function preg_match
returns an array with the following significant positions:
1 | ip |
4 | complete date - time |
5 | day |
6 | month |
7 | year |
8 | hour |
9 | min |
10 | seconds |
11 | mount point |
15 | result (HTTP code) |
16 | length in bytes |
18 | user agent |
19 | listening duration (seconds) |
Link to this FAQ: