Grail is capable of scanning petabytes of log data with high performance. However, the more you scan, the higher your log query consumption is. This is even true if the query doesn't return any data, as each scanned log record contributes to the total scanned bytes volume.
Follow this tutorial to reduce the size of retained and scanned log data, while still getting the expected results. This tutorial showcases how to apply some of the best practices for Log Management and Analytics in a real-life scenario.
This tutorial is intended for Dynatrace administrators setting up log monitoring.
Apply some of the best practices for Log Management and Analytics to optimize how you retain and scan logs.
In this tutorial, you'll learn how to:
Here are some things to think about before you start so that you can make an effective plan to optimize logs in Dynatrace.
Different sources use different ways to send log data. By estimating your daily ingest volume, you can better decide on data partition and segmentation.
For more about collecting and ingesting data, see Log ingestion.
Classify your log data and think about compliance and privacy requirements.
Classification: Which log types will you use?
Common log types are:
Application logs: Frequently used, typically for troubleshooting or alerting.
Audit logs: These must be stored for a longer period of time to fulfill compliance requirements.
They are not regularly used, and are usually accessed by only a few people.
Network logs: Can be your webserver logs, CDN, network devices.
These have a very high volume, and are therefore important to aggregate.
They are mostly consumed via
Dashboards, and are potentially good candidates for Log-based metrics extraction for cost-efficient monitoring and alerting.
Other log types: Any other logs your system generates, such as those used for troubleshooting, investigations, dashboarding, business analytics, or automations.
Compliance: How long do you need to store logs?
Retention time is defined at the bucket level.
Privacy: Are there specific requirements that demand data masking?
You can redact data on ingest with OneAgent, or during ingest processing with OpenPipeline.
Grail organizes data in buckets. Buckets behave like folders in a file system and are designed for records that should be handled together. These could be, for example, data that:
For more about buckets, see Configure data storage and retention for logs.
Let's assume that your organization has already prepared a plan for data segmentation, but hasn't yet configured anything in Dynatrace.
Your organization has two main user groups:
Dynatrace ingests and retains the following types of log data, described in the table below.
| Log type | Source | Daily ingest size | Bucket name | Retention | Relevant user group |
|---|---|---|---|---|---|
| Infrastructure logs | Kubernetes system logs monitored with OneAgent (journald) | 2 TB | infra_logs | 90 days | Platform |
| Application logs | Kubernetes monitored with OneAgent | 2 TB | app_logs | 60 days | Developers and Platform |
| Application logs | Lambda monitored with Lambda Layer | 1 TB | app_logs | 60 days | Developers and CloudOps |
| Access logs | CloudFront logs sent via Kinesis | 3 TB | access_logs | 365 days | CloudOps |
| Audit logs | AWS Resource Audit Logs | 2 GB | audit_logs | 3650 days (10 years) | Security |
First, you'll need to set up log ingestion. After that, you'll apply some of the best practices for Log Management and Analytics.
To set up log ingestion, follow the steps described in Log ingestion.
By default, all log data is ingested into the default_logs bucket. Ideally, after you have implemented all the best practices, only admins should have access to this bucket. Bucket permissions should follow the principle of least privilege, in which individual users have access to just the buckets that they're required to query or visualize.
There are two ways that you can verify data is ingested and retained.
The Log ingest overview ready-made dashboard, available in
Dashboards, lets you check ingested log volumes.
Use
Logs or
Notebooks to fetch logs from any bucket and validate if the ingested data arrives correctly and looks as expected.
Run the DQL query shown below.
fetch logs| filter dt.system.bucket == "default_logs"
If you don't see any log data, see Troubleshooting Log Management and Analytics for troubleshooting tips.
This step creates a dedicated bucket for certain data.
To create a bucket, go to
Settings > Storage management and select + Bucket.
Set the bucket name and display name.
For this example, set both to access_logs.
Set the retention period, in days.
For this example, set the period to 365.
Set the bucket table type.
For this example, set the type to logs.
Optional Select Retain with Included Queries and define the included query retention period.
For more info about Retain with Included Queries, see Take control of log query costs using Retain with Included Queries.
Select Create to save the bucket.
OpenPipeline handles log ingestion from all sources and allows processing, transformation and bucket assignment before logs are stored in Grail.
For this example, let's use OpenPipeline to filter logs on ingest. We'll configure a pipeline that processes CloudFront logs and stores them in the access_logs bucket.
Go to OpenPipeline and select Logs.
In the Pipelines tab, select + Pipeline to create a new pipeline.
Name the pipeline AWS CloudFront logs.
Add technology bundle processors.
Select Save to save the configuration.
Get the pipeline ID, which you'll need to filter logs later.
AWS CloudFront logs pipeline.Depending on how many pipelines are configured, you may need to select > to get to the right page.
In our example, the ID might be pipeline_AWS_cloudfront_logs_5498.
matchesValue(aws.log_stream, "CloudFront_*").AWS CloudFront logs pipeline that you just created.To verify the configuration, go to
Logs or
Notebooks and run the following query. This checks if the pipeline is processing the most recently ingested logs.
fetch logs| filter dt.openpipeline == {pipeline_AWS_cloudfront_logs_5498}
While still in OpenPipeline, open the Storage tab and select + Processor > Bucket assignment.
Set the bucket's name.
For this example, set the name to AWS access logs.
Leave the matching condition set to true.
In the Storage drop-down menu, select the access_logs bucket you already created.
Select Save.
This step grants users access to only specific buckets.
Open Account Management > Identity & access management > Policy management and then select the Boundaries tab.
Select + Boundary to create a new boundary.
access_log read.storage:bucket-name = "access_logs";.Select Save.
Open Account Management > Identity & access management > Group management.
Select + Group to create a new group.
For this example, name the new group CloudOps.
Select Create to create the group.
The View group page appears.
Select + Permission to add a new permission.
access_logs read boundary that you previously created.Select Save.
Open Account Management > Identity & access Management > User Management.
For each user that you want to assign to the CloudOps group, select > Edit.
Select the checkbox next to the CloudOps group.
You may need to search for the group using the Filter groups text field.
Select Save to save that user assignment.
Continue with all other users, as appropriate.
When you have assigned all relevant users, you can close the window or continue to use Dynatrace.
You've completed this tutorial. You now have an efficient log setup: