Thread: Change error code severity for syslog?
Hi
The Postgres errors when sent to syslog have their severity levels translated as follows:
I have a system which raises an alert every time syslog receives an ERROR (or higher severity level).
For most of the Postgres errors, translating it to WARNING level in syslog works, however, I wanted to translate ERROR codes XX000/1/2 in Postgres to be ERROR in syslog as well, so that it triggers the alert system and I can notified.
Is there any way to change the severity level for these specific error codes in Postgres?
Thanks
This correspondence (including any attachments) is for the intended recipient(s) only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis-transmission. If you receive this correspondence by mistake, please contact the sender immediately, delete this correspondence (and all attachments) and destroy any hard copies. You must not use, disclose, copy, distribute or rely on any part of this correspondence (including any attachments) if you are not the intended recipient(s).
On Thu, Oct 12, 2023 at 09:42:47AM +0900, Abhishek Bhola wrote: > For most of the Postgres errors, translating it to WARNING level in syslog > works, however, I wanted to translate *ERROR codes XX000/1/2* in Postgres > to be ERROR in syslog as well, so that it triggers the alert system and I > can notified. > > Is there any way to change the severity level for these specific error > codes in Postgres? You could, hypothetically, use the elog hook to switch dynamically the error data reports to something else depending on the types of filters you would like to apply to them. I have an example of this kind of idea in one of my plugin modules here: https://github.com/michaelpq/pg_plugins/tree/main/jsonlog -- Michael