Closed CarlLindqvist closed 7 months ago
Can you make an example please?
Sure. Here is a log output as json with a bunch of headers set (IPs obfuscated):
{
"time":"2024-02-12T07:53:52.410079233Z",
"level":"INFO",
"msg":"",
"request":{
"time":"2024-02-12T07:53:52.40991004Z",
"method":"GET",
"host":"X.X.X.X",
"path":"/",
"query":"",
"params":{},
"route":"",
"ip":"X.X.X.X",
"referer":"",
"length":0,
"header":{
"X-Amzn-Trace-Id":[
"Root=1-65c9ce90-6b85b2375fa9aeb27161a2dd"
]
},
"header":{
"User-Agent":[
"Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) XV6800"
]
},
"header":{
"Accept-Charset":[
"utf-8"
]
},
"header":{
"Accept-Encoding":[
"gzip"
]
},
"header":{
"X-Forwarded-For":[
"X.X.X.X"
]
},
"header":{
"X-Forwarded-Proto":[
"https"
]
},
"header":{
"X-Forwarded-Port":[
"443"
]
},
"user-agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) XV6800"
},
"response":{
"time":"2024-02-12T07:53:52.410061559Z",
"latency":151289,
"status":404,
"length":0
}
}
This is invalid json, the headers are duplicate keys
Oh! I see.
I read your first message too fast and was expecting duplicated "request" or "response" fields.
I just made a fix 👌
Now it looks a lot better! 👍
Logging request/response headers adds each header as a duplicate "header" key in json output. This is invalid json. It would be better to have the headers as a json array.