Chapter 7. Forward to Azure Monitor
You can forward logs to Azure Monitor by using the Logs Ingestion API.
7.1. Forward logs to Azure Monitor using the Logs Ingestion API Copy linkLink copied to clipboard!
Forward logs to Azure Monitor using the Logs Ingestion API with Data Collection Rules. This procedure shows how to configure the azureLogsIngestion output type with client secret authentication. For workload identity authentication, see the example at the end of this procedure.
Prerequisites
- You have an Azure account with permissions to create and manage Azure Monitor resources.
- You created a Data Collection Rule (DCR) in your Azure Log Analytics workspace.
You obtained the following information from your DCR:
- DCR immutable ID
- Stream name
- Data collection endpoint URL
- You created a {entra-id} service principal with the Monitoring Metrics Publisher role assigned to your DCR.
You obtained the following {entra-id} credentials:
- Tenant ID
- Client ID
- Client secret (for client secret authentication)
- You installed the Red Hat OpenShift Logging Operator.
-
You installed the OpenShift CLI (
oc). - You have administrator access.
Procedure
Create a secret containing your {entra-id} client secret:
$ oc create secret generic azure-entra-secret \ --from-literal=client-secret=<your_client_secret> \ -n openshift-loggingCreate a
ClusterLogForwardercustom resource (CR) or edit your existing CR. Replace the following values with your Azure configuration:-
Replace
<data_collection_endpoint>and<region>with your data collection endpoint URL. Find this URL in the Azure portal under your DCR details or runaz monitor data-collection endpoint show. -
Replace the
dcrImmutableIdvalue with your DCR immutable ID. Find this ID in the Azure portal under the DCR JSON view or runaz monitor data-collection rule show. -
Replace the
streamNamevalue with the stream name you defined in your DCR. The stream name must match exactly, including theCustom-prefix and_CLsuffix if your DCR uses them. -
Replace the
tenantIdvalue with your {entra-id} tenant ID. -
Replace the
clientIdvalue with your {entra-id} application (client) ID. -
The
secretNamevalue should match the name of the secret you created in step 1.
apiVersion: observability.openshift.io/v1 kind: ClusterLogForwarder metadata: name: azure-logs-forwarder namespace: openshift-logging spec: serviceAccount: name: logcollector outputs: - name: azure-logs-ingestion type: azureLogsIngestion url: https://<data_collection_endpoint>.<region>.monitor.azure.com azureLogsIngestion: dcrImmutableId: "dcr-1234567890abcdef1234567890abcdef" streamName: "Custom-MyApplicationLogs_CL" authentication: type: clientSecret clientSecret: tenantId: "12345678-1234-1234-1234-123456789012" clientId: "87654321-4321-4321-4321-210987654321" secret: secretName: azure-entra-secret key: client-secret pipelines: - name: application-logs inputRefs: - application outputRefs: - azure-logs-ingestion-
Replace
Apply the CR:
$ oc apply -f <filename>.yaml
Verification
Check the
ClusterLogForwarderstatus:$ oc get clusterlogforwarder instance -n openshift-logging -o jsonpath='{.status.conditions}' | jqLook for conditions indicating successful configuration and log delivery.
Verify that logs appear in your Azure Log Analytics workspace:
- Log in to the Azure portal.
- Navigate to your Log Analytics workspace.
Run a query against your custom log table to verify that logs are being ingested:
MyApplicationLogs_CL | take 10
Using workload identity authentication
If your environment supports {entra-id} Workload Identity, you can configure authentication without storing credentials in cluster secrets. Replace the values with your Azure configuration as described in the main procedure.
apiVersion: observability.openshift.io/v1
kind: ClusterLogForwarder
metadata:
name: azure-logs-forwarder
namespace: openshift-logging
spec:
serviceAccount:
name: logcollector
outputs:
- name: azure-logs-ingestion
type: azureLogsIngestion
url: https://<data_collection_endpoint>.<region>.monitor.azure.com
azureLogsIngestion:
dcrImmutableId: "dcr-1234567890abcdef1234567890abcdef"
streamName: "Custom-MyApplicationLogs_CL"
authentication:
type: workloadIdentity
workloadIdentity:
tenantId: "12345678-1234-1234-1234-123456789012"
clientId: "87654321-4321-4321-4321-210987654321"
pipelines:
- name: application-logs
inputRefs:
- application
outputRefs:
- azure-logs-ingestion
Workload identity authentication requires additional {entra-id} configuration, including a federated identity credential that trusts your Red Hat OpenShift Logging cluster’s OIDC issuer.
Configuring custom timestamp field
Some Azure Monitor schemas use different timestamp field names. For example, ASIM (Azure Sentinel Information Model) schemas use EventStartTime instead of the default TimeGenerated. Replace the values with your Azure configuration as described in the main procedure. The timestampField specifies the destination field for the timestamp in your DCR table schema. Common values are TimeGenerated (default), Timestamp (previous versions), or EventStartTime (ASIM).
apiVersion: observability.openshift.io/v1
kind: ClusterLogForwarder
metadata:
name: azure-logs-forwarder
namespace: openshift-logging
spec:
serviceAccount:
name: logcollector
outputs:
- name: azure-logs-ingestion
type: azureLogsIngestion
url: https://<data_collection_endpoint>.<region>.monitor.azure.com
azureLogsIngestion:
dcrImmutableId: "dcr-1234567890abcdef1234567890abcdef"
streamName: "Custom-AsimStream_CL"
timestampField: "EventStartTime"
authentication:
type: clientSecret
clientSecret:
tenantId: "12345678-1234-1234-1234-123456789012"
clientId: "87654321-4321-4321-4321-210987654321"
secret:
secretName: azure-entra-secret
key: client-secret
pipelines:
- name: application-logs
inputRefs:
- application
outputRefs:
- azure-logs-ingestion
7.2. Forward to Azure Monitor Logs Copy linkLink copied to clipboard!
You can forward logs to Azure Monitor Logs. The Vector Azure Monitor Logs sink provides this functionality.
The azureMonitor output type is deprecated and will be removed in a future release. This output type will become obsolete in September 2026.
Prerequisites
- You have basic familiarity with Azure services.
- You have an Azure account configured for Azure Portal or Azure CLI access.
- You have obtained your Azure Monitor Logs primary or the secondary security key.
- You have determined which log types to forward.
-
You installed the OpenShift CLI (
oc). - You have installed Red Hat OpenShift Logging Operator.
- You have administrator permissions.
Procedure
Create a secret with your shared key:
apiVersion: v1 kind: Secret metadata: name: my-secret namespace: openshift-logging type: Opaque data: shared_key: <your_shared_key>shared_key- Must contain a primary or secondary key for the Log Analytics workspace making the request.
Obtain a shared key by running the following command in the Azure CLI:
Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName "<resource_name>" -Name "<workspace_name>”Create or edit your
ClusterLogForwarderCR using the template matching your log selection.Forward all logs
apiVersion: observability.openshift.io/v1 kind: ClusterLogForwarder metadata: name: <log_forwarder_name> namespace: openshift-logging spec: serviceAccount: name: <service_account_name> outputs: - name: azure-monitor type: azureMonitor azureMonitor: customerId: my-customer-id logType: my_log_type authentication: sharedKey: secretName: my-secret key: shared_key pipelines: - name: app-pipeline inputRefs: - application outputRefs: - azure-monitorserviceAccount.name- The name of your service account.
customerId- Unique identifier for the Log Analytics workspace. Required field.
logType- Record type of the submitted data. Can only contain letters, numbers, and underscores (_), and cannot exceed 100 characters. For more information, see Azure record type in the Microsoft Azure documentation.