Skip to main content
September 28, 2010
Question

Receiving trace() calls via the Administration API

  • September 28, 2010
  • 2 replies
  • 619 views

The Administration API exposes many methods that allow for monitoring and administration of Flash Media Server. Evidently, the Administration Console provided with Flash Media Server uses this API via RTMP. It must then be possible to receive the log messages that are created when server-side actionscript calls the trace method as these messages are received by the Administration Console. But I cannot find any reference to this in the Administration API documentation. How can I pick up these messages?

For example, if you were to build your own administration console, as the documentation welcomes you to do, how would you replicate the "Live Log"?

    This topic has been closed for replies.

    2 replies

    September 28, 2010

    Bingo!

    var netStream : NetStream = new NetStream( netConnection );

    netStream.client = { onLog: handleLog };

    netStream.play( "logs/application/appName/instanceName", -1 );

    function handleLog ( info : Object ) : void {

         trace( info[ "description" ] );

    }

    September 28, 2010

    I'm pretty sure trace events for SSAS don't come through the admin service (someone will correct me if I'm wrong there). If my thinking is correct, the console makes a debug connection to the application to recieve the trace statements.

    I've never tried to listen trace events, and I haven't decompiled the console. So, I can tell you how to make the debug connection, but I don't know what event to listen for on the connection to get the trace events (perhaps someone from the eng team will chime in here... or you can just decompile the admin console to find it on your own)

    Making a debug connection involves a few steps:

    1. Create a variable number to represent your debug request Id. For this example, let's say it's 1234

    2. Invoke the approveDebugSession method on the admin service. If we assume you have a connection to the admin service on a netconnection named nc_admin, the call will look like this:

    nc_admin.call("approveDebugSession", null, "appName/instName", 1234);

    Where appName/instName is the application and instance you want to connect to

    3. Connect to your FMS app instance with the debug request id as a get variable like so:

    rtmp://domain.com/appName/instName?_fcs_debugreq_=1234

    September 28, 2010

    Hi Jay,

    Thanks for the info. I've started using tcpdump to examine the traffic that is going back and forth between the admin console and fms over port 1111. It seems that the trace messages definitely are coming back over port 1111.

    What seems to happen is that it first opens a stream to "&logs/application/apitester/development". "apitester" is the name of my application and "development" is the instance name. Here's the tcpdump:

    E...z.@.@.....m.

    H.Yo...WS...S...

    .............N.{

    ................

    .....=..C.......

    .play...........

    .&logs/applicati

    on/apitester/dev

    elopment...@....

    .

    Then, it starts receiving messages over the stream to an "onLog" handler:

    E..m..@.q...H.Yo

    ..m..W..S...S...

    ................

    .N.{......+.....

    ...onLog........

    ....stream..'/lo

    gs/application/a

    pitester/develop

    ment......level.

    ..script..code..

    .NetStream.Admin

    .Application..de

    .scription..8[Tu

    e.Sep.28.2010.15

    :48:34.GMT+0100]

    .-.c25@195.81.$$

    $.$$$..applicati

    on..Crtmp://_def

    aultRoot_/$$$$$$

    $$$$$.rtmphost.c

    o.m/apitester/de

    velopment..time.

    Br...).......

    It is not calling approveDebugSession, as far as I can tell.

    I have tried opening streams called "&logs/application/apitester/development" and similar but no luck so far.

    If anyone from the Flash Media Server team is listening, is this unsupported black magic? It doesn't seem like it should be.