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

Parsing a JSON with special characters.

Ellery
Helper

Hello, I have the following response that I need to parse, it's basically a JSON object where I need to retrieve the field 'x-real-ip,' but Dynatrace marks the character '-' as invalid.

 

 

        "headers": {
          "accept": "application/json, text/plain, */*",
          "accept-encoding": "gzip, deflate, br, zstd",
          "accept-language": "es-CL,es;q=0.9,en;q=0.8,en-US;q=0.7",
          "content-length": "3840",
          "content-type": "application/json",
          "cookie": "_ga=GA1.1.807424739.1711029955; dtCookie=v_4_srv_3_sn_AD0CB92A9B023486D52C166472FF433A_perc_100000_ol_0_mul_1_app-xxxxxxxxxx; rxVisitor=xxxxxxxxxx; dtSa=-; rxvt=1711457578849|1711454729279; dtPC=3$255775100_625h1vRHSFFAMLCWIPMNKLPUMKNBDGTBACILCR-0e0; _ga_VRHGLJ0CC3=GS1.1.1711455778.7.1.1711455787.51.0.0",
          "host": "prod.salud.achs.cl",
          "origin": "xxxxxxxxxx",
          "referer": "xxxxxxxxxx",
          "sec-ch-ua": "\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"",
          "sec-ch-ua-mobile": "?0",
          "sec-ch-ua-platform": "\"xxxxxxxxxx\"",
          "sec-fetch-dest": "empty",
          "sec-fetch-mode": "cors",
          "sec-fetch-site": "same-origin",
          "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
          "x-access-token": "xxxxxxxxxx",
          "x-dynatrace-application": "v=2;appId=c70633ee2206b4f0;injectionRule=auto;cookieDomain=achs.cl;rid=-xxxxxxxxxx;rpid=xxxxxxxxxx;en=e27ehw6g",
          "x-forwarded-for": "10.246.36.39",
          "x-forwarded-host": "xxxxxxxxxx",
          "x-forwarded-port": "443",
          "x-forwarded-proto": "https",
          "x-forwarded-scheme": "https",
          "x-real-ip": "10.12.36.121",
          "x-request-id": "373e44e474c844e6df809215447ffb12",
          "x-scheme": "https"
        },

 

 

my dql Code its: 

 

| PARSE content, "JSON{JSON:message}:parsejson"
| fields timestamp, alias:fecha,
	parsejson[message][properties][data][body][xxxxxxx], alias:xxxxxxx,
	parsejson[message][properties][data][body][xxxxxxx], alias:xxxxxxx,
	parsejson[message][properties][data][body][servicioIdentificacion][xxxxxxx], alias:xxxxxxx, 
	parsejson[message][properties][data][body][documentosMatriz][0][xxxxxxx], alias:xxxxxxx,
	parsejson[message][properties][data][body][documentosMatriz][0][xxxxxxx], alias:xxxxxxx,
	parsejson[message][properties][data][body][documentosMatriz][0][xxxxxxx], alias:xxxxxxx,
	parsejson[message][properties][data][headers][x-real-ip], alias:ip

 

2 REPLIES 2

krzysztof_hoja
Dynatrace Advisor
Dynatrace Advisor

Please use backticks: `x-real-ip`

Kris

Ellery
Helper

thanks, works perfects !!

Featured Posts