Azure Monitor Logs query client library samples for Java
Azure Monitor Logs Query samples are a set of self-contained Java programs that demonstrate interacting with Azure self -contained service using the client library. Each sample focuses on a specific scenario and can be executed independently.
Key concepts
Key concepts are explained in detail here.
Getting started
Getting started explained in detail here.
Examples
The following sections provide code samples covering common operations with the Azure Monitor Query client library.
Run large log queries using Log Analytics
Due to Log Analytics service limits, sometimes it may not be possible to retrieve all the expected data in a single query. For example, the number of rows returned or the maximum size of the data returned may exceed the stated limits. One approach for overcoming these limits is to split the queries into multiple smaller queries using different time ranges.
This workaround allows you to avoid the cost of exporting data to a storage account (and potentially the cost of the storage account as well).
Disclaimer: This approach of splitting data retrieval into smaller queries is useful when dealing with a few GBs of data or a few million records per hour. For larger data sets, exporting is recommended.
We've provided a sample that demonstrates how to split a large query into a batch query based on the number of rows. The sample can be found here. We've also provided a sample that demonstrates how to split a large query into a batch query based on the size of the data returned. The sample can be found here.
These samples show how to partition a large query into smaller queries using the LogsBatchQuery class. The partitioning is based on the timestamp "TimeGenerated".
These samples are suitable for simple data retrieval queries that utilize a subset of KQL operators. The subset of supported KQL operators can be found here.
Troubleshooting
Troubleshooting steps can be found here.
Next steps
See Next steps.
Contributing
If you would like to become an active contributor to this project please refer to our Contribution Guidelines for more information.