Initialize background worker with zero
Particularly, this sets bgw_type to empty which would otherwise print uninitialized data in the "background worker started" log message. (The PG log machinery will fall back to printing bgw_name instead.) We could instead just initialize bgw_type, but it seems safer to initialize all fields.
Example of a corrupted log message:
2024-08-15 11:43:49.196 CEST,,,575619,,66bdcdd5.8c883,1,,2024-08-15 11:43:49 CEST,,0,LOG,00000,"pgauditlogtofile worker started",,,,,,,,,"","@��3�",,0
Thank you for finding this. Indeed it could be possible. I'm not able to reproduce it, your log message looks like a pgaudit line that should not appear. Can you share your settings?
I think it would be better to use MemSet as in other parts of PostgreSQL code (ie. autoprewarm)
You need csvlog enabled to see the borked bgw_type field. Besides that, no special settings besides enabling pgaudit.log=all.
It's a static struct so = {0} will fully initialize it, no need for memset or other dynamic features.