Thanks Julius for replying. This is SAAS but we not on new dynatrace.
Yes there is no option but to parse this thing.
I already looked at the link you gave above last week and tried to use example 4 from it.
Though the use case is not entirely the same as mine.
Especially i used below use case from example 4 →
{
“content”: “{“intField”: 13, “stringField”: “someValue”, “nested”: {“nestedStringField1”: “someNestedValue1”, “nestedStringField2”: “someNestedValue2”} }”
}
Processing rule →
PARSE(content, "
JSON{
STRING:stringField,
JSON {STRING:nestedStringField1}:nested
}:parsedJson")
| FIELDS_ADD(top_level.attribute1: parsedJson[“stringField”], top_level.attribute2: parsedJson[“nested”][“nestedStringField1”])
| FIELDS_REMOVE(parsedJson)
Now i replicate above in my gui without using the nested stuff from above example(no nesting needed in my case)
My log content as shown on the processing rule page under “log sample” field is →
{
“event.type”: “LOG”,
“content”: “{\“level\”:\“INFO\”,\“message\”:\“hello world…\”,\“ts\”:\“2025-12-14T07:50:37.084703142Z\”,\“mac_id\”:\“server1\”}”,
“status”: “INFO”,
“timestamp”: “1771846247556”,
“loglevel”: “INFO”,
“log.source”: “/opt/dynatrace/logs/*.log”,
“dt.entity.host”: “HOST-xxxxxxxx”,
“dt.smartscape.host”: “HOST-xxxxxxxxx”
}
First question is → why it has put backslashes in the above content shown ?? under log sample field ?
i.e this → “content”: “{\“level\”:\“INFO\”,\“message\”:\“hello world…\”,\“ts\”:\“2025-12-14T07:50:37.084703142Z\”,\“mac_id\”:\“server1\”}”,
The original json log file content column doesnot have these backslashes.Does it make a difference ?
Then →
Matcher expression(automatically created by dynatrace) → dt.entity.host = “HOST-xxxxxxxx”( yes this is correct as this is the host from where we have fetched the logs and i have come to this page by selecting the log line and clicking on "create processing rule " button.
I feel the matcher expression is not complete yet, something more needs to come here.
Now taking inspiration from the example 4 i pasted below in the “processor definition” field →
PARSE(content, "
JSON{
STRING:level,
}:parsedJson")
| FIELDS_ADD(level_code: parsedJson[“level”])
| FIELDS_REMOVE(parsedJson)
And i get below error →
- Invalid processing rule definition: [1,15] Parse command pattern compile error: mismatched input ‘}’ expecting {‘<’, VARIABLE_ID, CHARGROUP, STRUCTURE, ENUM, JSON, JSON_OBJECT, JSON_ARRAY, JSON_VALUE, ARRAY, DATA, LDATA, LD, KVP, GENERIC_ID, STRING_OPEN, NEWDOC_OPEN, ‘(’, ‘{’}
Attached screenshot as well. Kindly help. I feel the expression is not correct.