azure-docs-sdk-java/docs-ref-autogen/com.azure.monitor.ingestion...

96 строки
15 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.monitor.ingestion.LogsIngestionAsyncClient"
fullName: "com.azure.monitor.ingestion.LogsIngestionAsyncClient"
name: "LogsIngestionAsyncClient"
nameWithType: "LogsIngestionAsyncClient"
summary: "This class provides an asynchronous client for uploading custom logs to an Azure Monitor Log Analytics workspace."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **LogsIngestionAsyncClient**"
methods:
- uid: "com.azure.monitor.ingestion.LogsIngestionAsyncClient.upload(java.lang.String,java.lang.String,java.lang.Iterable<java.lang.Object>)"
fullName: "com.azure.monitor.ingestion.LogsIngestionAsyncClient.upload(String ruleId, String streamName, Iterable<Object> logs)"
name: "upload(String ruleId, String streamName, Iterable<Object> logs)"
nameWithType: "LogsIngestionAsyncClient.upload(String ruleId, String streamName, Iterable<Object> logs)"
summary: "Uploads logs to Azure Monitor with specified data collection rule id and stream name."
parameters:
- description: "the data collection rule id that is configured to collect and transform the logs."
name: "ruleId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the stream name configured in data collection rule that matches defines the structure of the\n logs sent in this request."
name: "streamName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the collection of logs to be uploaded."
name: "logs"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>&gt;"
syntax: "public Mono<Void> upload(String ruleId, String streamName, Iterable<Object> logs)"
desc: "Uploads logs to Azure Monitor with specified data collection rule id and stream name. The input logs may be too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split the input logs into multiple smaller requests before sending to the service.\n\nEach log in the input collection must be a valid JSON object. The JSON object should match the [schema defined by the stream name][]. The stream's schema can be found in the Azure portal.\n\n**Upload logs to Azure Monitor**\n\n```java\nList<Object> logs = getLogs();\n logsIngestionAsyncClient.upload(\"<data-collection-rule-id>\", \"<stream-name>\", logs)\n .subscribe();\n```\n\n\n[schema defined by the stream name]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-structure#streamdeclarations"
returns:
description: "the <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that completes on completion of the upload request."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.monitor.ingestion.LogsIngestionAsyncClient.upload(java.lang.String,java.lang.String,java.lang.Iterable<java.lang.Object>,com.azure.monitor.ingestion.models.LogsUploadOptions)"
fullName: "com.azure.monitor.ingestion.LogsIngestionAsyncClient.upload(String ruleId, String streamName, Iterable<Object> logs, LogsUploadOptions options)"
name: "upload(String ruleId, String streamName, Iterable<Object> logs, LogsUploadOptions options)"
nameWithType: "LogsIngestionAsyncClient.upload(String ruleId, String streamName, Iterable<Object> logs, LogsUploadOptions options)"
summary: "Uploads logs to Azure Monitor with specified data collection rule id and stream name."
parameters:
- description: "the data collection rule id that is configured to collect and transform the logs."
name: "ruleId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the stream name configured in data collection rule that matches defines the structure of the\n logs sent in this request."
name: "streamName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the collection of logs to be uploaded."
name: "logs"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>&gt;"
- description: "the options to configure the upload request."
name: "options"
type: "<xref href=\"com.azure.monitor.ingestion.models.LogsUploadOptions?alt=com.azure.monitor.ingestion.models.LogsUploadOptions&text=LogsUploadOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Void> upload(String ruleId, String streamName, Iterable<Object> logs, LogsUploadOptions options)"
desc: "Uploads logs to Azure Monitor with specified data collection rule id and stream name. The input logs may be too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split the input logs into multiple smaller requests before sending to the service. If an <xref uid=\"com.azure.monitor.ingestion.models.LogsUploadOptions.setLogsUploadErrorConsumer(java.util.function.Consumer<com.azure.monitor.ingestion.models.LogsUploadError>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"error handler\"></xref> is set, then the service errors are surfaced to the error handler and the subscriber of this method won't receive an error signal.\n\nEach log in the input collection must be a valid JSON object. The JSON object should match the [schema defined by the stream name][]. The stream's schema can be found in the Azure portal.\n\n**Upload logs to Azure Monitor**\n\n```java\nList<Object> logs = getLogs();\n LogsUploadOptions logsUploadOptions = new LogsUploadOptions().setMaxConcurrency(4);\n logsIngestionAsyncClient.upload(\"<data-collection-rule-id>\", \"<stream-name>\", logs, logsUploadOptions)\n .subscribe();\n```\n\n\n[schema defined by the stream name]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-structure#streamdeclarations"
returns:
description: "the <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that completes on completion of the upload request."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.monitor.ingestion.LogsIngestionAsyncClient.uploadWithResponse(java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions)"
fullName: "com.azure.monitor.ingestion.LogsIngestionAsyncClient.uploadWithResponse(String ruleId, String streamName, BinaryData logs, RequestOptions requestOptions)"
name: "uploadWithResponse(String ruleId, String streamName, BinaryData logs, RequestOptions requestOptions)"
nameWithType: "LogsIngestionAsyncClient.uploadWithResponse(String ruleId, String streamName, BinaryData logs, RequestOptions requestOptions)"
summary: "This method is used to upload logs to Azure Monitor Log Analytics with specified data collection rule id and stream name."
parameters:
- description: "The immutable Id of the Data Collection Rule resource."
name: "ruleId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The streamDeclaration name as defined in the Data Collection Rule."
name: "streamName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "An array of objects matching the schema defined by the provided stream."
name: "logs"
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
- description: "The options to configure the HTTP request before HTTP client sends it."
name: "requestOptions"
type: "<xref href=\"com.azure.core.http.rest.RequestOptions?alt=com.azure.core.http.rest.RequestOptions&text=RequestOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Response<Void>> uploadWithResponse(String ruleId, String streamName, BinaryData logs, RequestOptions requestOptions)"
desc: "This method is used to upload logs to Azure Monitor Log Analytics with specified data collection rule id and stream name. This upload method provides a more granular control of the HTTP request sent to the service. Use <xref uid=\"com.azure.core.http.rest.RequestOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RequestOptions\"></xref> to configure the HTTP request.\n\nThe input logs should be a JSON array with each element in the array matching the [schema defined by the stream name][]. The stream's schema can be found in the Azure portal. This content will be gzipped before sending to the service. If the content is already gzipped, then set the `Content-Encoding` header to `gzip` using <xref uid=\"com.azure.core.http.rest.RequestOptions.setHeader*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"requestOptions\"></xref> and pass the content as is.\n\n**Header Parameters**\n\n | ---------------------- | ------ | -------- | ----------------- |\n | Name | Type | Required | Description |\n | Content-Encoding | String | No | gzip |\n | x-ms-client-request-id | String | No | Client request Id |\n\n**Request Body Schema**\n\n```java\n[\n Object\n ]\n```\n\n\n[schema defined by the stream name]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-structure#streamdeclarations"
returns:
description: "the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> on successful completion of <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;&gt;"
type: "class"
desc: "This class provides an asynchronous client for uploading custom logs to an Azure Monitor Log Analytics workspace. This client encapsulates REST API calls, used to send data to a Log Analytics workspace, into a set of asynchronous operations.\n\n## Getting Started ##\n\nTo create an instance of the <xref uid=\"com.azure.monitor.ingestion.LogsIngestionClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LogsIngestionClient\"></xref>, use the <xref uid=\"com.azure.monitor.ingestion.LogsIngestionClientBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"LogsIngestionClientBuilder\"></xref> and configure the various options provided by the builder to customize the client as per your requirements. There are two required properties that should be set to build a client:\n\n1. `endpoint` \\- The [data collection endpoint][]. See <xref uid=\"com.azure.monitor.ingestion.LogsIngestionClientBuilder.endpoint(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"endpoint\"></xref> method for more details.\n2. `credential` \\- The AAD authentication credential that has the \"Monitoring Metrics Publisher\" role assigned to it. [Azure Identity][] provides a variety of AAD credential types that can be used. See <xref uid=\"com.azure.monitor.ingestion.LogsIngestionClientBuilder.credential(com.azure.core.credential.TokenCredential)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"credential\"></xref> method for more details.\n\n**Instantiating an asynchronous Logs ingestion client**\n\n```java\nLogsIngestionAsyncClient logsIngestionAsyncClient = new LogsIngestionClientBuilder()\n .credential(tokenCredential)\n .endpoint(\"<data-collection-endpoint>\")\n .buildAsyncClient();\n```\n\n### Client Usage ###\n\nFor additional information on how to use this client, see the following method documentation:\n\n * <xref uid=\"com.azure.monitor.ingestion.LogsIngestionAsyncClient.upload(java.lang.String,java.lang.String,java.lang.Iterable<java.lang.Object>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"upload(String, String, Iterable)\"></xref> \\- Uploads logs to a Log Analytics workspace.\n * <xref uid=\"com.azure.monitor.ingestion.LogsIngestionAsyncClient.upload(java.lang.String,java.lang.String,java.lang.Iterable<java.lang.Object>,com.azure.monitor.ingestion.models.LogsUploadOptions)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"upload(String, String, Iterable, LogsUploadOptions)\"></xref> \\- Uploads logs to a Log Analytics workspace with options to configure the upload request.\n * <xref uid=\"com.azure.monitor.ingestion.LogsIngestionAsyncClient.uploadWithResponse(java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"uploadWithResponse(String, String, BinaryData, RequestOptions)\"></xref> \\- Uploads logs to a Log Analytics workspace with options to configure the HTTP request.\n\n\n[data collection endpoint]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-endpoint-overview?tabs=portal#create-a-data-collection-endpoint\n[Azure Identity]: https://learn.microsoft.com/java/api/overview/azure/identity-readme?view=azure-java-stable"
metadata: {}
package: "com.azure.monitor.ingestion"
artifact: com.azure:azure-monitor-ingestion:1.2.4