Hello,
I used the socket_listener, as follows:
[[inputs.socket_listener]]
URL to listen on
service_address = “unix:///var/run/audispd_events”
socket_mode = “”
The socket already exists, it was made by the program writing to the socket, whilst Telegraf should only read( listener). As result, I get the following error:
[telegraf] Error running agent: starting input inputs.socket_listener: listen unix /var/run/audispd_events: bind: address already in use
And telegraf stop.
In the code it is written:
if protocol == “unix” || protocol == “unixpacket” || protocol == “unixgram” {
// no good way of testing for “file does not exist”.
// Instead just ignore error and blow up when we try to listen, which will
// indicate “address already in use” if file existed and we couldn’t remove.
//nolint:errcheck,revive
os.Remove(addr)
}
However, on my telegraf, it doesn’t ignore the error and telegraf stops. Is the code wrong, or is there config to ignore the error (and have telegraf just listen to the socket, rather than creating it). The socket should not be removed in any case by telegraf if it starts, so i think the os.Remove looks questionable here.
Best Regards,
Menno