Dynatrace Log Management and Analytics gives you the ability not only to view and analyze logs but also to create metrics based on log data and use them throughout Dynatrace like any other metric. You can add them to your dashboard, include them in an analysis, and even create custom alerts.
You need to count how many refused connections are recorded in your log data. For that, filter the correct logs and turn the number of occurrences into a log metric. By tracking the metric, you can track possible firewall, network connectivity or server configuration issues.
To build and run your query:
fetch logs| filter matchesPhrase(content, "Connection refused")| sort timestamp desc
This query performs the following actions:
Connection refused
phrase found in the log content.log.
metric key: log.conn_refused_count
.matchesPhrase(content, "Connection refused")
Connection refused
.Connection refused
phrase.To view the result in Data Explorer
log.conn_refused_count
log key.You need to monitor an attribute of your logs, and you need to keep an eye on the error levels reported in your logs from your K8s cluster. Find the correct logs from Grail, and use the filters to create a new metric for these. Add log status (error/warning/info) to your metric, which makes it easy to track these with metrics.
To build and run your query
fetch logs| filter matchesValue(dt.entity.kubernetes_cluster, "KUBERNETES_CLUSTER-92233333")| summarize count(), by:status
This query performs the following actions:
dt.entity.kubernetes_cluster
attribute containing the KUBERNETES_CLUSTER-92233333
phrase in the log content.log.
metric key: K8-92233333
.matchesValue(dt.entity.kubernetes_cluster, "KUBERNETES_CLUSTER-92233333")
KUBERNETES_CLUSTER-92233333
.status
.To view the result in Data Explorer
log.K8-92233333
log key and, in the Split by, add status
.