cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace Pattern Language to Dynamically Parse JSON Content Field

Ardhi
Contributor

Hi,

 

Can we parse dynamically log content to json field and append the name also?
For example

 

{
"content": "{\"level\":\"info\",\"ts\":1679455681.3355558,\"caller\":\"web/request_log.go:33\",\"msg\":\"OK\",\"request_id\":\"xxx\",\"method\":\"GET\",\"path\":\"/example/path\",\"response_time\":47.768859,\"status\":200}",
}

to become like this (see the appended "app_" to the field name)

 

{
  "content": "{\"level\":\"info\",\"ts\":1679455681.3355558,\"caller\":\"web/request_log.go:33\",\"msg\":\"OK\",\"request_id\":\"xxx\",\"method\":\"GET\",\"path\":\"/example/path\",\"response_time\":47.768859,\"status\":200}",
  "app_level":"info",
  "app_ts":1679455681.3355558,
  "app_caller":"web/request_log.go:33",
  "app_msg":"OK",
  "app_request_id":"xxx",
  "app_method":"GET",
  "app_path":"/example/path",
  "app_response_time":47.768859,
  "app_status":200,
}

 

I checked from here https://www.dynatrace.com/support/help/observe-and-explore/logs/log-monitoring/log-processing/log-pr... , but it seems I need to parse using Dynatrace Pattern Language so can be reused on any content log.


Any idea?

1 REPLY 1

ChadTurner
DynaMight Legend
DynaMight Legend

@Ardhi your thinking and presentation is correct. You'll just need to formulate the processing rule definition. 

-Chad

Featured Posts