Plugin sorts message keys alphabetically
Closed this issue · 4 comments
Hello all!
When messages are delivered to CW, their order does not match the original order. I see that keys into each message have been sorted alphabetically
2021-04-09T05:57:20.000+03:00
{"az":"us-west-1a","ec2_instance_id":"i-053fe634ac7beb193","log_level":"error","message":"*1088800 recv() failed (104: Co.....}
But the original order of these messages is different
{"log_level":"error","message":"*1088800 recv() failed (104: Co.....", "az":"us-west-1a","ec2_instance_id":"i-053fe634ac7beb193"}
Is this an undocumented feature? Or this behavior issue is relevant to a fluent-bit parser?
Is it possible to disable this behavior? (keys soring)
PS1:
Just have changed the output plugin from Cloudwatch (amazon-cloudwatch-logs-for-fluent-bit) to stdout and got the original order into messages. So, this issue is related to the CW plugin
It looks like the root cause of my issue is here
https://stackoverflow.com/questions/48293036/prevent-alphabetically-ordering-json-at-marshal
Also JSON doesn't support any concept of ordering for keys... any code processing logs in CW shouldn't be relying on field ordering.
Close this one as JSON doesn't have an ordering so we don't plan to support this feature.
This should be fixed. Please listen to those who actually use these logs for troubleshooting.