Advanced Logging – How does Real-time logging work?

We announced and release a Beta for a sparkling new Logging module for IIS at MIX 09. This is a super rich logging module with a lot of functionality that our team will continue to blog about. Today, I wanted to share more technical details on how my favorite feature, real-time logging work in Advanced Logging.

Before we go into details, you may want to take a short pause and read some overview material in my blog post, extension page for Advanced Logging or go over the custom logging walkthrough. Okay, I will now assume you are somewhat familiar with this module.

Next, let us take a scenario - You have a SL or any HTTP client that collects analytic information that you want to be able to send to IIS web server and get that captured in a log file. Let’s add a little twist, while you want this you also want to be able to write custom code that can consume this log information in real time and enable you to do some real time reporting. The reason you want to do that is just to provide a report on real-time interactions by clients or simply monitor your network in real-time.


Here is how IIS Advanced Logging helps

 

image

Let us go over this architecture, step-by-step:

  1. The clients on the left hand side (could be Silverlight application, native Silverlight runtime, could be ASP.net or anything really), sends a HTTP POST message with the log in the body. It is a simple XML format and you can find details in the walkthrough Real-time Logging.
  2. This message lands on an IIS server that has Advanced Logging (AL) installed. The client logging functionality in AL parses this message and raises an internal event.
  3. The core server-side logging functionality gets this event and then looks up the log configuration to compose a log entry and writes it to the file. (Note: you would need to have relevant configuration so that AL knows what fields to expect. You can find an example in the Client logging walkthrough.
  4. In addition, just before an entry is written to the log file, server-side logging raises another event using public APIs (IIS HTTP_TRACE_EVENT infrastructure) that can be consumed by a simple module written by YOU. Believe me, it is a simple module. You can find details and sample code in the walkthrough Real-time Logging.
  5. Now, your module can take this information push it to a service in the cloud, a DB and produce reports in real-time.

Let me know if you need more details. The best to learn more is to try it out :).

No Comments