### YamlMime:JavaPackage uid: "com.azure.monitor.ingestion" fullName: "com.azure.monitor.ingestion" name: "com.azure.monitor.ingestion" summary: "The Azure Monitor Ingestion client library is used to send custom logs to an [Azure Monitor][] Log Analytics workspace.\n\n\n[Azure Monitor]: https://learn.microsoft.com/azure/azure-monitor/overview" classes: - "com.azure.monitor.ingestion.LogsIngestionAsyncClient" - "com.azure.monitor.ingestion.LogsIngestionClient" - "com.azure.monitor.ingestion.LogsIngestionClientBuilder" enums: - "com.azure.monitor.ingestion.LogsIngestionServiceVersion" desc: "The Azure Monitor Ingestion client library is used to send custom logs to an [Azure Monitor][] Log Analytics workspace.\n\n## Getting Started ##\n\n### Prerequisites ###\n\nThe client library requires the following:\n\n * Java 8 or later\n * An Azure subscription\n * An existing Azure Monitor Data Collection Rule\n * An existing Azure Monitor Data Collection Endpoint\n * An existing Azure Monitor Log Analytics workspace\n\n--------------------\n\n### Authenticate a Client ###\n\nThe and can be authenticated using Microsoft Entra ID. To authenticate with Microsoft Entra ID, create a that can be passed to the . The Azure Identity library provides implementations of for multiple authentication flows. See for multiple authentication flows. See [Azure Identity][] [Azure Identity][] for more information. See for more examples on authenticating a client.\n\nThe following sample demonstrates how to create a using and TokenCredential authentication.\n\n```java\nLogsIngestionClient logsIngestionClient = new LogsIngestionClientBuilder()\n .credential(tokenCredential)\n .endpoint(\"\")\n .buildClient();\n```\n\n--------------------\n\n## Overview ##\n\nThe Logs Ingestion REST API in Azure Monitor lets you send data to a Log Analytics workspace. The API allows you to send data to [supported tables][] or to custom tables that you create. You can also extend the schema of Azure tables with custom columns to accept additional data.\n\nThe Azure Monitor Ingestion client library provides both synchronous and asynchronous client implementations, providing you the capability to send custom logs to an Azure Monitor Log Analytics workspace.\n\n--------------------\n\n### Key Concepts ###\n\n**Data Collection Endpoint**\n\nData Collection Endpoints (DCEs) allow you to uniquely configure ingestion settings for Azure Monitor. [This article][] provides an overview of data collection endpoints including their contents and structure and how you can create and work with them.\n\n**Data Collection Rule**\n\nData collection rules (DCR) define data collected by Azure Monitor and specify how and where that data should be sent or stored. The REST API call must specify a DCR to use. A single DCE can support multiple DCRs, so you can specify a different DCR for different sources and target tables.\n\nThe DCR must understand the structure of the input data and the structure of the target table. If the two don't match, it can use a transformation to convert the source data to match the target table. You may also use the transform to filter source data and perform any other calculations or conversions.\n\nFor more details, see [Data collection rules][] in Azure Monitor. For information on how to retrieve a DCR ID, [see this tutorial][].\n\n**Log Analytics Workspace Tables**\n\nCustom logs can send data to any custom table that you create and to [certain built-in tables][supported tables] in your Log Analytics workspace. The target table must exist before you can send data to it.\n\n**Logs retrieval**\n\nThe logs that were uploaded using this library can be queried using the [Azure Monitor Query client library][].\n\n--------------------\n\n## Client Usage ##\n\n### Uploading logs to Azure Monitor ###\n\nThe following sample demonstrates how to upload logs to Azure Monitor using .\n\n```java\nList logs = getLogs();\n logsIngestionClient.upload(\"\", \"\", logs);\n System.out.println(\"Logs uploaded successfully\");\n```\n\nFor more synchronous and asynchronous client usage information, see and , respectively.\n\n\n[Azure Monitor]: https://learn.microsoft.com/azure/azure-monitor/overview\n[Azure Identity]: https://learn.microsoft.com/java/api/overview/azure/identity-readme?view=azure-java-stable\n[supported tables]: https://learn.microsoft.com/azure/azure-monitor/logs/logs-ingestion-api-overview#supported-tables\n[This article]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-endpoint-overview?tabs=portal\n[Data collection rules]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-overview\n[see this tutorial]: https://learn.microsoft.com/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#collect-information-from-the-dcr\n[Azure Monitor Query client library]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/monitor/azure-monitor-query#readme" metadata: {} package: "com.azure.monitor.ingestion" artifact: com.azure:azure-monitor-ingestion:1.2.4