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 and storage: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

Step 1 Create a segment for a single log bucket

  1. Go to Segments and select Segment to add a new segment
  2. Enter the segment name
  3. Select Add from data types > Logs to include logs in your segment
  4. Type to filter and select dt.system.bucket
  5. Specify a certain bucket to filter for (for example, dt.system.bucket = logs_default)
  6. Select Save

Successfully configured segments are displayed in the segments list. Select > Edit to modify a segment.

Step 2 optional 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)

  1. Select Variable

  2. Query the list of log buckets, sorted alphabetically

    fetch dt.system.buckets
    | filter dt.system.table == "logs"
    | fields bucket=name
    | sort bucket
  3. Select Run query

  4. Select Done to finish variable configuration

  5. Replace static logs_default bucket name with $bucket variable

  6. Select Save

Successfully configured variables are displayed as on top of existing include blocks of a segment. Select Edit variable(s) to modify variables.

Step 3 Query logs by bucket

You can analyze logs in different apps. To query for logs in Notebooks

  1. Go to Notebooks and select Notebook
  2. Select Logs
  3. Open the segment selector and, in Filter by segments, select the previously created segment for log buckets
  4. In the Select an option list, select one or more log buckets to filter for
  5. Select Apply to finish segment selection
  6. 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.