Lesson 7 of 7 Microsoft Sentinel Collection

Creating Custom Log Tables

This lesson explains how to create custom tables, and how to send them data.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare the Logs Ingestion API with Custom logs via AMA.
  • Identify table requirements.
  • Describe the components of ingestion.
  • Explain the use of transformations.

When a custom table is needed

An in-house application or a niche product may produce useful security events with no Sentinel connector. A custom log table holds such data, and it can then be queried, used in analytics rules, and retained like any other table. Custom tables have names ending in _CL, and the portal adds this suffix automatically. Azure's built-in tables cannot be deleted, but custom tables can.

Two main paths feed custom tables, as the following comparison shows.

Logs Ingestion API
SourceAn application or script that sends JSON
MechanismHTTPS POST with a Microsoft Entra token
Table schemaAny columns, with TimeGenerated
StatusGenerally available
Choose when You control the application's code
Custom logs via AMA
SourceA text or JSON file on a machine
MechanismAzure Monitor Agent with a DCR
Table schemaTimeGenerated and RawData
StatusThe Sentinel connector is in preview
Choose when You can only read a log file
Scenario questions

Choosing an ingestion path

Exam skills 4.2.7

Choose the custom log path for each source.

Log in to try this activity Interactive activities are free with an account.

Table requirements

A custom table needs a TimeGenerated column of type datetime, and Azure adds it to the DCR transformation if it is missing. Each column has a name and a type, and a custom column name must begin with a letter, with up to 45 alphanumeric or underscore characters. Custom columns added to Azure's own tables need the _CF suffix. Columns can be added or deleted, but an existing column cannot be modified, and DCRs must be updated after schema changes.

Table plans are Analytics, which is the default, Basic, and Auxiliary or Lake. Creating and managing tables needs Microsoft.OperationalInsights/workspaces/* at workspace scope, as in Log Analytics Contributor. Creating a DCR needs Microsoft.Insights/dataCollectionRules/write, as in Monitoring Contributor. Tables can be created in the portal, or with the Azure CLI, Azure PowerShell, REST, Bicep or ARM templates.

True or false

Custom table rules

Exam skills 4.2.7

Check the rules for custom log tables.

Log in to try this activity Interactive activities are free with an account.

Using the Logs Ingestion API

The Logs Ingestion API accepts a JSON array posted to a DCR's endpoint. It needs a Microsoft Entra application, or a managed identity, with the Monitoring Metrics Publisher role on the DCR, and it enforces TLS 1.2 or higher. A data collection endpoint is needed only for private link, or for an older DCR with no logs ingestion endpoint of its own.

A DCR declares a stream, which describes the incoming data, and a transformation, which maps it to the table.

  1. Create the table

    Define a table such as AppSecurity_CL, with its columns.

  2. Create the DCR

    Define the incoming stream, the transformation and the destination.

  3. Grant access

    Assign Monitoring Metrics Publisher on the DCR to the sender.

  4. Send data

    POST JSON to the endpoint, with a token for https://monitor.azure.com.

  5. Query

    Confirm the data in the table, which can take several minutes at first.

The endpoint has this form: {endpoint}/dataCollectionRules/{dcrImmutableId}/streams/{streamName}?api-version={apiVersion}. A transformation can parse fields, rename columns, drop sensitive values and add calculated values.

The following diagram shows the steps of an ingestion request.

Sending custom data with the Logs Ingestion API. A sender, an application or managed identity holding the Monitoring Metrics Publisher role on the data collection rule, posts a JSON array over TLS 1.2 or later to the rule's endpoint with a token for monitor.azure.com. The rule's stream describes the incoming data, its transformation parses, renames or drops fields, and the result lands in a custom table such as AppSecurity_CL.
The transformation can drop sensitive values before storage.
Put in order

Sending application events

Exam skills 4.2.7

Put the steps of sending data with the Logs Ingestion API in order.

Log in to try this activity Interactive activities are free with an account.

Custom logs from files

Where an application only writes files, use the Azure Monitor Agent. In Sentinel, the Custom logs via AMA connector, in preview, supports many listed device types. A table for this source has exactly two fields: TimeGenerated of type DateTime and RawData of type String. For forwarder-collected logs, the second field is named Message. If a listed device type is chosen, do not edit the portal's Transform field, since the transformation is provided. The same RBAC requirements apply as for Syslog: rights to deploy the agent and to create DCRs.

Transformations for security and cost

Transformations run at ingestion, so they can improve data before it is stored. They can remove personal data for privacy, drop noisy records to reduce cost, or parse a field into columns to simplify later queries. The following transformation drops debug records and hides a value.

source
| where Level != "Debug"
| extend UserName = hash_sha256(UserName)
Worked example

Sending application events

An in-house application running in Azure App Service must send JSON security events to Microsoft Sentinel. No secret may be stored, and analysts want named columns, not a single text field. What should you build?

Create a custom table with named columns and TimeGenerated, and a DCR with a stream and transformation. Give the app a managed identity with Monitoring Metrics Publisher on the DCR, and have it call the Logs Ingestion API.

Custom logs via AMA needs an agent and a file, which App Service does not suit, and it yields raw text. An application secret would break the requirement. The older HTTP Data Collector API should not be used for new work.

Check yourself

Which role lets an application send data through the Logs Ingestion API?

Show answer

Monitoring Metrics Publisher, assigned on the data collection rule.

Exam Tips

Remember for the exam

  • Custom tables end in _CL, and need TimeGenerated.
  • Grant Monitoring Metrics Publisher on the DCR to the sender.
  • A data collection endpoint is usually unnecessary now.
  • Custom logs via AMA tables have TimeGenerated and RawData.