Welcome! Log In Create A New Profile

Advanced

Log VLC access requests in nginx

Posted by elgarne 
Log VLC access requests in nginx
September 14, 2015 03:40PM
In my company, we have a dreambox that receives satellite channels and broadcast to multiple users. The url to access one channel looks like this: http://192.168.31.62:8001/1:0:1:0A34:3FE:1:D00220:0:1:0: where 192.168.31.62 is the IP of the dreambox. To make it easier for users to access channels, I use nginx as a reverse proxy. Users request http://tv.mydomain.com/channel1 with VLC to get the channel and that works fine.

But the problem occurs when I try to monitor in nginx logs who is watching what. When the request arrives to nginx, nothing appears in the logs but the channel is well displayed in VLC. However, when I close VLC, disconnect information appears in the logs.

Note that if I open the URL from a browser (safari) instead of VLC, the access request appears in the nginx access logs.

Can someone help understand:
- Why logs appear if the request comes from a browser but not from VLC?
- How to make the request appear in nginx logs at connection time?

Thank you in advance.
Re: Log VLC access requests in nginx
September 14, 2015 04:36PM
Interesting, we're doing the same thing with enigma2 boxes but we use xbmc (called kodi now), anyway are you sure vlc is not accessing the box directly bypassing nginx?

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Log VLC access requests in nginx
September 15, 2015 03:19AM
Hi,

How can VLC bypass nginx? The dns entry of the url I enter in VLC leads to nginx. Moreover, when VLC disconnects, I see the event in the access logs. Also, if I open the same url from a browser, I see the request in the access logs.
Re: Log VLC access requests in nginx
September 15, 2015 05:00AM
If you see the disconnect you must also see the connect, maybe a difference between a get/post request where with post you don't see the url in the log.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Log VLC access requests in nginx
September 15, 2015 05:14AM
I tested all log levels of nginx and none of them add any line in the logs (error and access) when VLC accesses this url.
Re: Log VLC access requests in nginx
September 15, 2015 05:32AM
Actually, I see the GET request only when I close the stream in VLC.
Here it is:
192.168.31.233 - - [15/Sep/2015:11:31:39 +0200] "GET /channel1 HTTP/1.1" 200 1712170 "-" "VLC/2.1.2 LibVLC/2.1.2"
Re: Log VLC access requests in nginx
September 15, 2015 05:42AM
Sounds like log buffering of some kind, could be that a continues open link is buffered until it is closed before it is written to the logs, which sounds logical as nginx does not yet know how much data has been send in order to complete the logging.
It should be possible to capture the request in Lua and log that separately.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Log VLC access requests in nginx
September 15, 2015 05:49AM
That makes sense. Especially with the following tests.
How can I capture the request in Lua, please?

I'm allowing users inside my company to access these urls without authentication, based on their IP.
If I access the url from outside the company, with an unknown IP, then it requires a couple of login/password thanks to auth_basic_user_file. In this case, I see an access log entry when the GET request arrives, with the user IP. But, the username is logged only when the stream ends.
Here is the flow:
1 - Access http://tv.mydomain.com/channel1 from an unknown IP
2 - The following entry is logged:
193.74.128.232 - - [15/Sep/2015:11:37:17 +0200] "GET /channel1 HTTP/1.1" 401 194 "-" "VLC/2.1.2 LibVLC/2.1.2"
3 - I enter my login/password in vlc
4 - I end the stream by closing vlc window
5 - The following entry is logged:
193.74.128.232 - elgarne [15/Sep/2015:11:40:53 +0200] "GET /channel1 HTTP/1.1" 200 62060342 "-" "VLC/2.1.2 LibVLC/2.1.2"

Ideally, I'd like to have steps 4 and 5 switched, in order to know, before user ends the stream, who is watching what.
Thanks again.
Re: Log VLC access requests in nginx
September 15, 2015 06:16AM
4 and then 5 is normal nginx behavior, your going to need something between 3 and 4, running a nginx debug build with full debugging on should show you the logging you need, locate this debug log code in the sources and build a normal version with only this debug line enabled.

A Lua solution is better asked here https://groups.google.com/forum/#!forum/openresty-en
just be clear (like your last post) what you want to happen, maybe someone there can give a hint.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Log VLC access requests in nginx
September 15, 2015 06:48AM
Thank you very much.
I'm running osx and brew. I built a version with debug and run some tests. I enabled debug level in nginx.conf.
Good news: client IP is logged.
Bad news: username is not logged before the stream ends. But I can live with that.
Re: Log VLC access requests in nginx
January 18, 2016 05:23AM
itpp2012 Wrote:
-------------------------------------------------------
> Interesting, we're doing the same thing with enigma2 boxes but we use
> xbmc (called kodi now), anyway are you sure vlc is not accessing the
> box directly bypassing nginx?


Was wondering how you are streaming to a nginx protocol can you do this direct from vlc ?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 145
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready