Generate Dynatrace log parsing (DPL) rules from sample logs
Project description
Dynatrace Log Rule Helper
Generate Dynatrace log parsing rules from real log examples — without writing DPL by hand.
Dynatrace log processing rules use Dynatrace Pattern Language (DPL), a small but strict domain-specific language. Writing these rules manually is slow, error-prone, and difficult to validate.
This tool takes a sample log line (JSON) and produces a ready-to-paste Dynatrace log processing rule.
No DPL expertise required.
Why This Tool Exists
In Dynatrace, extracting fields from logs requires defining log processing rules using DPL constructs like:
- PARSE
- LD
- SPACE?
- INT, FLOAT, STRING
Common problems:
- One missing token breaks the rule
- No syntax validation in the UI
- No preview or test extraction
- Difficult to translate human-readable logs into DPL grammar
This tool solves that by translating log examples into valid DPL rules automatically.
What This Tool Is (and Is Not)
What it is
- A helper utility that converts log examples into Dynatrace log parsing rules
- A DPL rule generator
- A copy-paste companion for Dynatrace Log Monitoring configuration
What it is not
- Not a Dynatrace API client
- Not a log ingestion tool
- Not a replacement for Dynatrace log processing
Python is only the implementation language — users do not need Python knowledge.
Who Should Use This
- Dynatrace engineers working with log parsing
- SREs and observability engineers creating log-based attributes
- Anyone tired of manually writing DPL rules
- Teams building dashboards, alerts, and metrics from logs
Installation
From PyPI (recommended)
pip install dynatrace-dpl-helper
From source
git clone https://github.com/technomonstert/dt-log-helper.git cd dt-log-helper pip install -e .
Supported Command-Line Flags
| Short Flag | Long Flag | Description | Example |
|---|---|---|---|
-f |
--file |
Path to the sample log file (JSON or plain text) | --file sample.json |
-l |
--literal |
Fixed text or JSONPath expression to match in the log | --literal "Billed Duration:" |
-v |
--value |
Example value to extract from the log | --value 5034 |
-t |
--type |
Matcher type (INT, FLOAT, STRING, JSONPATH) |
--type INT |
-a |
--alias |
Attribute name to create in Dynatrace | --alias aws.billed.duration |
--dry-run |
Print the generated DPL rule without writing files | --dry-run |
|
--verbose |
Enable verbose/debug output | --verbose |
Notes
- Multiple values can be provided as required.
- Attribute aliases do not need any order.
Quick Start
Input log example (Assuming this is the content of sample.json)
{ "content": "Billed Duration: 5034" }
Command
dynatrace-dpl-helper --file sample.json --literal "Billed Duration:" --value 5034 --type INT --alias aws.billed.duration
Output (DPL rule)
PARSE(content, "LD 'Billed Duration:' SPACE? INT:aws.billed.duration")
Paste this directly into:
Dynatrace → Settings → Log Monitoring → Processing → Add processing rule
Note:
This does not always produce syntactically valid DPL rules as this tool is still in development. Always validate this with test option provided at Dynatrace log processing rule creation page.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynatrace_dpl_helper-1.0.2.tar.gz.
File metadata
- Download URL: dynatrace_dpl_helper-1.0.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c4e09aa5760ae9156799ae464c883e7a4a4d1d87be21ce1cbf6c70ee6d12fdd
|
|
| MD5 |
bc64a4008ca1083dafb4586fcc9acbb9
|
|
| BLAKE2b-256 |
60bd98a39867b32b444de32d2a1c3cd9a6b4a3ccd3589010606150296cd60a1d
|
File details
Details for the file dynatrace_dpl_helper-1.0.2-py3-none-any.whl.
File metadata
- Download URL: dynatrace_dpl_helper-1.0.2-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
079e50e16a8e4d63b94e6b4106c5112b5b7b93b0ff577ceab34efddb8e89010b
|
|
| MD5 |
3d45e5ccddd7a32903844885da265883
|
|
| BLAKE2b-256 |
31fa7a5a8d5a6ffc8a2c66340964881be116eab9a0d02010cb28864c23144198
|