Azure OMS Log Analytics Step by Step – Data Collector API

I see a lot of potential in Azure Log Analytics. That should go without saying considering the amount of time I have spent learning and documenting it over the past few weeks. One of the most exciting features that adds tremendous flexibility is the ability to log directly to Log Analytics with the Web API. Logging to the Web API enables anything to be written to Log Analytics without the use of the Microsoft Monitoring agent.

In this video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell. The goal was to create a universal way to write any data to log analytics. I did this by creating a function that takes the date, the log Type and a hashtable of key and data pairs and writes it to a Log Analytics workspace.

The function can be added to a script and used to send data directly to Log Analytics. I use it in a Module added to Azure Automation. From there I can write data to Log Analytics from any Azure Automation Runbooks. Once in Log Analytics, I can trigger alerts or tie into Logic Apps to kick off other Run Books, alerts or webhooks to other systems.

Additional data can be found here:
https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-collector-api
https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-ingestion-time

The function can be found here:
https://github.com/tsrob50/LogAnalyticsAPIFunction

3 thoughts on “Azure OMS Log Analytics Step by Step – Data Collector API

  1. Hello Travis,
    Thanks for a great article!!
    I have requirement where i need to the availability of my application by polling the Webstart page URL as well as monitoring all basic database and server metrics such as:

    TABLEMANAGE/AUTOMANAGE
    STEPSYSBLOB_PCT > 90% (warning)
    STEPSYSBLOB_PCT > 95% (critical)
    STEPSYSDATA_PCT > 90% (warning)
    STEPSYSDATA_PCT > 95% (critical)

    For this which one do you recommend:
    1. Azure automation
    2.. Data collector API

    Do you have any document to setup tablespace monitoring on oracle database ?

  2. Unfortunately, I don’t have anything on monitoring Oracle tablespaces. If Oracle generates its own performance log, that log could be pulled into Log Analytics as a custom log (see my other post on custom logs). If Oracle can generate performance monitor data (Windows), it could be logged that way. Or, a runbook could be created in Azure Automation that monitors and logs results to the API.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.