Loading...
Loading...
Create and manage Oodle log-based metric rules — extract metrics from log streams using filter expressions and groupBy labels.
npx skill4agent add oodle-ai/agent-skills oodle-log-metricsgroupBybrew install oodle-ai/oodle/oodle
oodle configureoodle log-metrics list -o json | jq 'length'groupByoodle traces list ...groupByoodle log-metrics create -f rule.jsonupdateget| Task | Command |
|---|---|
| List rules | |
| Get rule | |
| Create rule | |
| Update rule | |
| Delete rule | |
{
"name": "http_errors_from_logs",
"filter": "level=error AND service=api",
"groupBy": ["service", "env"],
"metricName": "oodle.log.http_errors"
}| Field | Meaning |
|---|---|
| Human identifier for the rule |
| Boolean expression over log fields ( |
| Labels promoted from log fields onto the emitted metric |
| The Prometheus-style metric name to emit |
# ✅ CORRECT — validate filter first, then create
# (preview with the log explorer or `oodle traces list` if traces and logs share the same backend)
oodle log-metrics create -f rule.json
# ❌ WRONG — creating with an untested filter; the resulting metric is silently empty
oodle log-metrics create -f <(echo '{"name":"x","filter":"levl=eror","groupBy":[],"metricName":"x"}')# ✅ CORRECT — get → edit → update
oodle log-metrics get lm_123 -o json > rule.json
jq '.groupBy = ["service","env"]' rule.json > rule.new.json
oodle log-metrics update lm_123 -f rule.new.json
# ❌ WRONG — partial payload removes existing fields
oodle log-metrics update lm_123 -f <(echo '{"groupBy":["service"]}')# ✅ CORRECT — verify and delete
oodle log-metrics get lm_123 -o json > /dev/null
oodle log-metrics delete lm_123 --force
# ❌ WRONG — speculative delete by name match
oodle log-metrics delete "$(oodle log-metrics list | grep errors | awk '{print $1}')" --forcefilterlevl=eror# ✅ CORRECT — preview matching log volume in the log explorer first;
# only then run `oodle log-metrics create`
# (or temporarily create a synthetic monitor that hits the matching logs and confirm count > 0)
# ❌ WRONG — create the rule, then notice the dashboard panel is empty next week
oodle log-metrics create -f rule.jsongroupByrequest_iduser_idtrace_idpath# ✅ CORRECT — bounded labels
"groupBy": ["service", "env"]
# ❌ WRONG — `user_id` blows up cardinality (one series per user)
"groupBy": ["service", "env", "user_id"]getupdateupdate# ✅ CORRECT
oodle log-metrics get lm_123 -o json > rule.json
jq '.filter = "level=error AND service=api AND status=5xx"' rule.json > rule.new.json
oodle log-metrics update lm_123 -f rule.new.json
# ❌ WRONG — clobbers groupBy and metricName
oodle log-metrics update lm_123 -f <(echo '{"filter":"level=error"}')metricNameoodle.log.<domain>.<measurement># ✅ CORRECT
"metricName": "oodle.log.http_errors"
# ❌ WRONG — generic name collides with other rules
"metricName": "errors"| Error | Cause | Fix |
|---|---|---|
| 401 Unauthorized | Invalid or missing API key | Run |
| 404 Not Found | Log-metric rule ID does not exist | Verify with |
| connection refused | Wrong | Check |
| Filter has a syntax error | Use |
| Metric exists but has no data points | Filter doesn't match any logs | Re-test the filter in the log explorer; check label names match the log schema |
| Cardinality alarm in the UI | | Edit the rule to drop that field; old series age out at the regular retention |
| 429 Too Many Requests | Bulk rule creation | Add |