Red Hat Bugzilla – Bug 880535
Error inserting events when the message contains null bytes
Last modified: 2013-07-16 10:43:08 EDT
Description of problem:
We monitor a JBoss and we activated Log Event Sources. In Jboss there is an application which put some errors in log. RHQ tries to insert these errors in the events table but it fails because "invalid byte sequence for encoding "UTF8": 0x00".
This is a known problem with Postgres, strings containing null characters cannot be inserted in "text" fields because Postgres is written in C where null character is used as string terminator.
The solution would be to process these strings in RHQ by removing null characters.
Version-Release number of selected component (if applicable):
2012-11-27 10:03:25,779 WARN [org.rhq.enterprise.server.event.EventManagerBean] addEventData: Insert of events failed : Batch entry 1 INSERT INTO RHQ_Event (id, event_source_id, timestamp, severity, detail) VALUES ((SELECT nextval('RHQ_EVENT_id_seq'::text)), (SELECT id FROM RHQ_Event_Source WHERE event_def_id = (SELECT id FROM RHQ_Event_Def WHERE name = 'logEntry' AND resource_type_id = (SELECT id FROM RHQ_Resource_Type WHERE name = 'JBossAS Server' AND plugin = 'JBossAS')) AND resource_id = '10433' AND location = '/home/jboss/projects/jboss-server/2/server/dorun/log/server.log'), '1354006941407', 'ERROR', '###error message not shown###') was aborted. Call getNextException to see the cause.
2012-11-27 10:03:25,779 WARN [org.rhq.enterprise.server.event.EventManagerBean] : ERROR: invalid byte sequence for encoding "UTF8": 0x00
Events with null bytes in message description should be successfully inserted.
Would you be able to create a patch?
I will try, depends on my workload.
I am thinking, though, if this will become useless when the events will go to Cassandra.