What is Template Logging?
- Traditional
- Template
Using the fmt Helper
The logger.fmt tagged template creates a log template:
Benefits of Templates
Log Aggregation
Logs with the same template are grouped together in the dashboard
Pattern Recognition
Identify patterns and anomalies in your logs
Cardinality Control
High-cardinality fields don’t explode your log count
Example: Pattern Recognition
Syntax
Basic Usage
With Additional Attributes
Combine templates with extra attributes:When to Use Templates
Good Use Cases
Good Use Cases
Variable identifiers:Metrics with varying values:Status messages with context:
When Not to Use Templates
When Not to Use Templates
Static messages (no variables):Low-cardinality enums:Sensitive data:
Template vs. String Interpolation
| Scenario | Recommendation |
|---|---|
| High-frequency events | Use templates |
| User/session-specific IDs | Use templates |
| Debugging in development | String interpolation is fine |
| Rare events | Either works |
| Fixed set of values | Use attributes |
Examples
- E-commerce
- API Server
- Authentication
Dashboard Features
In the Proliferate dashboard, template logs enable:- Template grouping: See all instances of a template together
- Parameter analysis: View distribution of parameter values
- Pattern detection: Identify unusual parameter distributions
- Trend analysis: Compare template frequency over time
- Search: Find logs by template or parameter values

