Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support For Unix Domain Sockets #98

Open
pgiblock opened this issue Aug 9, 2022 · 1 comment
Open

Add Support For Unix Domain Sockets #98

pgiblock opened this issue Aug 9, 2022 · 1 comment

Comments

@pgiblock
Copy link

pgiblock commented Aug 9, 2022

It would be nice if this logger would support Unix Domain Sockets as the target instead of only (host, port) inet addresses. UnixDomainSocketAddress was added in Java 16. However, this library need not depend on that if SocketAddress can be supplied to getLogger() which has been around since 1.4.

This feature would be particularly useful for container environments such as Docker because some not very nice tricks are required for a container to connect to a host socket. Note that Unix domain sockets are supported by Fluentd and Fluent-Bit.

@pgiblock
Copy link
Author

pgiblock commented Aug 9, 2022

For anyone else running into this problem, there is a workaround that I find cleaner than running with host networking or having to address the host by address/hostname, bind on the interface, and implement firewall rules. It requires running a little forwarder to "proxy" the data from docker-lived networking to the host-lived domain socket:

docker run -h fluent -v /var/run/fluent-bin.sock:/sock fluent/fluent-bit:1.9 \
    -i forward -o forward -p unix_path=/sock

You'll likely need to place this on the right network(s), but docker containers can now forward to the hostname "fluent" and records will appear on the actual host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant