mpihlak/pg_logforward — pull request #5 by petere (2012-11-29 22:06:26+00:00)
Title: RFC: instance label

I have many instances on many hosts sending (JSON) log data to a collecting server, and it's hard to tell on the receiving side what instance a message is associated with. You can get the origin IP and port of the UDP packet, but that's weird and error prone. Typically, PG instances are identified by host name and port, but they are sometimes moved around, and then you'd still want to maintain the same instance identity.

So I propose adding an "instance_label" field to the netstring and JSON packets, which defaults to "hostname:port" but can be set to anything.

Syslog already reports the hostname and has an APP-NAME field which is currently hardcoded to "postgres". I didn't touch that, but it might be worth thinking about how to align all these things best.

So I include here some crude code to that effect. Let me know what you think.