Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Display Streaming Radio logs
This guide concerns the listening information of Streaming Radio which 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 subsequently processed.
Preamble
- Your radio logs will be provided as 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 range 84.16.67.128/25 should be ignored as these are the streaming servers.
- From the settings page on the Manager, you can request the logs from past days.
- You can also directly export them to ACPM or Mediapulse.
Enable FTP log sending
For this:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the relevant product.
- Click on the name of the audio stream in question.
- Click on Settings in the left sidebar.
- Enable FTP log export with the toggle switch.
- Enter a hostname: FTP server address.
- Enter a username: FTP account name.
- Enter a password: that of the FTP account.
- Enter the directory on the server where to store the logs.
- Click on the Save button at the bottom of the page:
Process the logs
The best option 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 for 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: