Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Export logs Streaming Radio by FTP
This guide concerns listening information for Streaming Radio which can be exported through the FTP protocol Logs are then automatically transferred by FTP to be processed (attention, the operation requires programming knowledge). You can also export them directly to ACPM or Mediapulse.
Preamble
- Your radio logs will be provided as a compressed file xyz.mp3-20140805.log.gz (log date is 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 poorly formed, because of too long a reference e.g.; this Icecast behavior cannot be changed.
- The addresses in row IP 84.16.67.128/25 must be ignored as these are streaming servers.
- From the Settings page on the Manager, you can request logs from past days.
Enable the sending of logs by FTP
To this end:
- Click here in order to access the management of your product on the Manager Infomaniak (Need help?).
- Click directly on the nameallocated to the product concerned.
- Click on the name of the audio stream concerned.
- Click on Parameters in the left side menu.
- Enable the export of logs by FTP with the toggle switch.
- Enter one host name: address of the FTP server.
- Enter one username: name of the FTP account.
- Enter one password: the FTP account.
- Enter the directory on the server in which the logs are stored.
- Click on the button Save at the bottom of the page:
Processing logs
The best is to use a regular expression like this:
"/^(\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 should be adapted if other functions/languages are used.
The function preg_match
gives a table showing the following significant positions:
1 | ip |
4 | date - full time |
5 | day |
6 | months |
7 | year |
8 | time |
9 | min |
10 | seconds |
11 | mounting point |
15 | result ( HTTP code) |
16 | length in bytes |
18 | user agent |
19 | listening time (seconds) |
Link to this FAQ: