monitoring-plugins icon indicating copy to clipboard operation
monitoring-plugins copied to clipboard

logfile: Ignore decode errors

Open leo-pempera opened this issue 5 months ago • 0 comments

If there are unconforming entries in the input file the python open function can´t parse the input and throws an exception as the default error handling is set to 'strict'. Setting it to 'ignore' skips these characters and lets the exectuion continue.

In our monitoring we have seen the following error a couple of times:

Traceback (most recent call last):
  File "logfile.py", line 476, in 'module'
  File "logfile.py", line 292, in main
  File "'frozen codecs'", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 3565: invalid start byte

The following line was the offending one in the log:

2025-07-31T05:15:03.646865+02:00 XXXX [XXXX][1060]: ERROR: <core> [XXXX]: parse_msg(): ERROR: parse_msg: message=<k._#030#031<H^?#010#015#0046e#036X%e#021~#003xek#034=YC#011#bb#016XB&q~nq#007{<99><D2>>

leo-pempera avatar Jul 31 '25 07:07 leo-pempera