Segment logs by bucket
Configure a segment to function as a convenient filter for logs by Grail buckets to optimize query performance and license consumption.
Who this is for
This article is intended for administrators controlling data partitioning in Grail buckets as well as power users aiming for more efficient log queries.
What you will learn
In this article, you'll learn how to create a new segment to function as a log bucket filter for fetching logs queries.
Before you begin
- Dynatrace SaaS environment powered by Grail and AppEngine.
- You have both
storage:filter-segments:write
andstorage:filter-segments:read
permissions. To learn how to set up the permissions, see Permissions in Grail.
- Grail bucket
Logs powered by Grail can be stored in different buckets. Buckets can improve query performance by reducing query execution time and the scope of data read.
Steps
Create a segment for a single log bucket
Add a variable to filter for any log bucket
Query logs by bucket
Create a segment for a single log bucket
- Go to Segments and select Segment to add a new segment
- Enter the segment name
- Select Add from data types > Logs to include logs in your segment
- Type to filter and select
dt.system.bucket
- Specify a certain bucket to filter for (for example,
dt.system.bucket = logs_default
) - Select Save
Successfully configured segments are displayed in the segments list. Select > Edit to modify a segment.
Add a variable to filter for any log bucket
Ingest sources lists built-in and custom ingest sources for a data type in your environment. To configure your own ingest sources (such as API endpoints for a service, technology, or team)
-
Select Variable
-
Query the list of log buckets, sorted alphabetically
fetch dt.system.buckets| filter dt.system.table == "logs"| fields bucket=name| sort bucket -
Select Run query
-
Select Done to finish variable configuration
-
Replace static
logs_default
bucket name with$bucket
variable -
Select Save
Successfully configured variables are displayed as on top of existing include blocks of a segment. Select Edit variable(s) to modify variables.
Query logs by bucket
You can analyze logs in different apps. To query for logs in Notebooks
- Go to Notebooks and select Notebook
- Select Logs
- Open the segment selector and, in Filter by segments, select the previously created segment for log buckets
- In the Select an option list, select one or more log buckets to filter for
- Select Apply to finish segment selection
- Select Run query to query for logs of the selected buckets
Conclusion
You’ve configured a segment for a single bucket statically. You’ve learned how variables help to make segments more dynamic and cover broader use cases. Lastly, you’ve seen how to analyze logs of certain buckets, allowing optimization of query performance and license consumption.