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

DQL parsing Json and extracting new column

Good afternoon community,

in my log line I have a field called:

custom_headers

 

y_buccellato_1-1723466812323.png

 

custom headers contains this value:

{"id":"261004620","name":"OrderId","value":"5602867201"},
{"id":"260996569","name":"xxxxother","value":"xxxxxx"}

out of all of it I'd like to extract and keep:

OrderId as the name of the column and then each row to be the actual id ("value":"56xxxxx")

Reviewed DPL/DQL but things are quite complex,
thanks for any help here,

regards,

Yann

1 REPLY 1

Thanks to internal Dynatrace help I was able to solve this.

The new Processor worked like this:

parse custom_headers[0],"JSON:temp1"
|parse custom_headers[1],"JSON:temp2"
|fieldsAdd SalesOrderId = if(temp1[name] == "SalesOrderId",temp1[value],else:temp2[value])

The two first line defines separate Json from the whole array (the one in position [0] and the on in [1]).
The last line adds a field called SalesOrderID and the value will match  temp1[value] if temp1[name] == "SalesOrderId" or will match temp2[value]  if temp1[name] will not be"SalesOrderId".

Regards

Featured Posts