Azure Data Explorer - Kusto

This extension streams your log data to your table in Azure Data Explorer (also known as Kusto), where you can analyze and visualize your logs in real time.

Support is enabled by including the following module in the overlay:

1
2
3
4
5
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-azure-monitor</artifactId>
    <version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-azure-monitor:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
    imports {
        mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
    }
}

dependencies {
    implementation "org.apereo.cas:cas-server-support-azure-monitor"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
    /*
        The following platform references should be included automatically and are listed here for reference only.

        implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
        implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
        
    */
    implementation "org.apereo.cas:cas-server-support-azure-monitor"
}
:information_source: Remember

If you are interesting in Azure Monitor as an application performance monitoring tool, you may want to take a look at this guide.

This integration uses a custom strategy that’s used in the RollingFileAppender. Logs are written into the rolling file to prevent any data loss arising out of network failure while connecting to the Kusto cluster. The data is stored in a rolling file and then flushed to the Kusto cluster.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<RollingFile name="AzureData" fileName="cas-${date:yyyyMMdd}.log"
             filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
    <KustoStrategy
        clusterIngestUrl="${env:LOG4J2_ADX_INGEST_CLUSTER_URL}"
        appId="${env:LOG4J2_ADX_APP_ID}"
        appKey="${env:LOG4J2_ADX_APP_KEY}"
        appTenant="${env:LOG4J2_ADX_TENANT_ID}"
        dbName="${env:LOG4J2_ADX_DB_NAME}"
        tableName="log4jTest"
        logTableMapping="log4jCsvTestMapping"
        mappingType="csv"
        flushImmediately="true"
    />
    <CsvLogEventLayout delimiter="," quoteMode="ALL"/>
    ...
</RollingFile>

The following fields are supported:

Property Description
clusterIngestUrl The ingest URI for your cluster in the format https://ingest-<cluster>.<region>.kusto.windows.net.
dbName The case-sensitive name of the target database.
tableName The case-sensitive name of an existing target table.
appId The application client ID required for authentication, stored from Microsoft Entra App registration.
appKey The application key required for authentication, stored from Microsoft Entra App registration.
appTenant The ID of the tenant in which the application is registered, stored from Microsoft Entra App registration.
logTableMapping The name of the mapping.
mappingType The type of mapping to use. The default is csv.
flushImmediately If set to true, the sink flushes the buffer after each log event. The default is false.