My problem: I try to send logs from python3 project via logging
module to fluentd.
log = '{"@timestamp":"2020-06-18T11:52:37.391","severity":"INFO", "message":"Processing request started"}'
logging.error(json.dumps(log))
At fluentd I get such error:
pattern not matched data="<14>{"@timestamp":"2020-06-18T11:52:37.391","severity":"INFO", "message":"Processing request started"}\x00"
I see strange symbols, <14>
and \x00
. When I try to send same string via bash console --everything works well
echo -n '{"@timestamp":"2020-06-18T11:52:37.391","severity":"INFO", "message":"Processing request started"}' > /dev/udp/HOST/PORT
Looks like there are some problems with encoding, but I can't recognise how to fix this error in python.