Ingested logs can be triggers for opening new Davis problems.
Using a combination of metrics based on logs and custom alerts, you can use the power of different Dynatrace Intelligence data analyzers to address use cases from simple threshold-based alerting to seasonal baselines, for example:
Follow this guide to learn more about alerting with metrics based on logs.
If you don't need to set thresholds, you should follow the instructions in Set up alerts based on events extracted from logs.
In this example we will open a new Davis problem when certain records, which contain a specific phrase, are ingested and exceed a static threshold.
You can find alerts by opening
Logs and using the following DQL query.
fetch logs| filter matchesPhrase(content, "Dropping data because sending_queue is full")| sort timestamp desc
parse, fieldAdd, or other transformations, you should add a processing rule to set those fields on ingest.dt.openpipeline.pipelines field. Use that value when selecting a pipeline in OpenPipeline settings.Add metric extraction configuration in OpenPipeline.
Open
Settings > Process and contextualize > OpenPipeline > Logs and select the Pipelines tab.
Find the pipeline you want to modify, or add a new pipeline.
Select > Edit. The pipeline configuration page appears.
Select Metric extraction tab.
Set
The metric name and ID.
The DQL matcher. A matcher sets the condition for the event that is to be extracted. It is a subset of filtering conditions in a single DQL statement.
In Matching condition, use the matcher as shown below.
matchesPhrase(content, "Dropping data because sending_queue is full")
If you use Segments or your permissions are set at the record level, you should include those conditions in the matcher.
There are situations when a matcher can't be easily extracted from a DQL statement. In these cases, you can create log alerts for a log event or summary of log data.
Add dimensions.
For most logs, you can add automated correlation to entities in Dynatrace Intelligence root cause analysis.
To do this, add a dt.source_entity dimension or any other field that contains an entity identifier.
If you added the extraction rule to an existing pipeline, logs are already routed there and no further configuration is needed.
If you created a new pipeline, configure a dynamic route so logs reach it:
Fields that are computed or added during the Processing stage cannot be used in dynamic route matching conditions because routing is evaluated before Processing. This includes fields added by Dynatrace itself, such as dt.entity.service. For a full list of fields with this limitation, see Fields with limits for all configuration scopes.
Go to
Settings > Process and contextualize > OpenPipeline > Logs and select the Dynamic routing tab.
Select Dynamic route and set:
Name: For example, use Dropping data alert route.
Matching condition: Use the same condition as the metric extraction matcher so the route narrows the data to the records you actually want to process.
matchesPhrase(content, "Dropping data because sending_queue is full")
Pipeline: Select the new pipeline.
Select Add.
Routes are evaluated top to bottom and the first matching route wins. If you have other routes that could match the same logs, place this route above them.
Go to
Anomaly Detection and create a new custom alert.
Set the scope for your alert.
Use DQL syntax to point the metric you created.
To have your alert connected to monitored entity make sure to add by: {dt.source_entity}.
Define the alerting conditions under which a new Davis event will be generated.
You can pick different
Anomaly Detection analyzers.
Finally set the event details like title and description.
When the alerting conditions are met you will see a new problem in
Problems.
Here's when to use a custom alert with metrics based on logs:
http.response_time.Detected anomalies can trigger automations using simple workflows as described in Create a simple workflow in Dynatrace Workflows.