Results 1 to 6 of 6

Thread: Logging to a webservice via ILogNotify or a custom Module

  1. #1

    Default Logging to a webservice via ILogNotify or a custom Module

    I have a requirement to send log values to an internal webservice for reporting on bandwidth and other analytics. I've researched this on the forum and have found several threads about this, and it seems like there are 3 main ways to do this:
    1. Put the webservice call in the onLog method of a custom ILogNotify class
    2. Put the webservice call in the disconnect or SessionDestroy event in a custom module
    3. Log4j Appender (I've ruled this out for my scenario)

    So, first off, I noticed several warnings from you guys about calling a webservice for logging because of performance issues, but I'm hoping to solve those problems by doing the following:
    1. Only logging certain types of events to the webservice
    2. Calling the webservice asynchronously using an ExecutorService and a CachedThreadPool

    Ok, now to my questions:

    First question:
    From my research of old forum posts, it seemed like a custom ILogNotify class was the way to go, but I ran into the following issue. Along with all the other properties that get logged, I need to send a few extra things to the webservice, like the username of the user watching the video. I have a custom module that pulls a encrypted token off of the request URL and then extracts some information (like the username) from it, so I need to know how to make the username available to my ILogNotify code from my module. How can I do that?

    Second Question:
    Should I really be using an ILogNotify class for this? It seems like it would fit better in the onDisconnect or onHTTPSessionDestroy event within my existing module. I looked at doing it this way, but it's not clear to me how to get all the same values that are being logged from within the module. Can I get all the same values from within a module as the WMSLoggerFactory.getGlobalLogValue() exposes in the ILogNotify onLog() method?

    I would prefer to write this functionality into my module if possible. Please let me know what you think.

    Last edited by seanngreen; 02-11-2013 at 05:16 PM.

  2. #2
    Join Date
    Dec 2007



    You can add x-sname-query to the Appender .Fields list to capture querystring.

    I think probably the best way in terms of overhead to capture all logs is with a UDP Appender, but for the direction you are describing take a look at the IOPerformanceCounter. For example, in IMediaStreamActionNotifiy.onStop you can do

    public void onStop(IMediaStream stream)
    	IOPerformanceCounter perf = stream.getMediaIOPerformance();
    	getLogger().info("OutBytesRate for " + stream.getName() + ": " + perf.getMessagesOutBytes());
    Similarly, for HTTP and RTSP sessions, you can do this:


  3. #3


    Thanks for the quick reply. The first link you gave doesn't really apply to me. See, the username is in an encrypted token that is attached to the URL, and then my module calls a webservice passing the token and the service returns back whether or not the user can play the stream, along with the user's username. So, I need a way to make the username available to my code executing in the onLog event in my ILogNotify class. Actually, I just noticed that the IMediaStream has a getProperties() method that returns back a WMSProperties object. Can I just add it there like this:
    httpSession.getStream().getProperties().put("UserName", "TestUserName");
    Then pick it up in the onLog method since the stream object is passed to that method? I'll give it a try in a minute...

    Even if that works, I would rather have my code in my module instead of in the ILogNotify class. I understand that I can get some things using the IOPerformanceCounter, but I want to pass ALL values that are logged to the wowza log (for certain events) to my webservice, so I need to know how and where to access them from within the module. It looks like they might all be available in the Session, Stream, Client, and IOPerformanceCounter objects, but it would be helpful to know how to access each value that gets logged to the wowza log, from within the module. Is there any documentation like that?

    Last edited by seanngreen; 02-11-2013 at 06:14 PM.

  4. #4
    Join Date
    Dec 2007



    There isn't such a document, a mapping between log fields and IOPerformanceCounter, but the example I showed, getMessagesOutBytes, maps to sc-bytes (server to client bytes). You can follow that to replicate the basics. What can't you replicate from the performance counter or stream properties?


  5. #5


    Here are the values from the log that are most important to me:
    date + time + tz

    Was just trying to find x-status and x-suri. Where would I get those?

  6. #6
    Join Date
    Dec 2007


    x-status is populated with HTTP status codes

    I think you will have to use the correct one per circumstance, it is not a property of the stream or in the IOPerformanceCounter

    You can get s-uri from the IClient in onConnect with client.getURI()

    In HTTP session, you can put s-uri together with the properties of the HTTPSession


Similar Threads

  1. Logging custom module to a different file
    By maugzoide in forum General Forum
    Replies: 7
    Last Post: 10-03-2014, 10:52 AM
  2. Custom Logging
    By kenji24 in forum Tutorials
    Replies: 6
    Last Post: 03-28-2014, 07:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts