remoteAddress.getAddress().getHostAddress() error

1、Deploy graylog in a docker container, write a custom plugin, and get the HostAddress exception after accepting the log;

remoteIp should be the ip of the host sending the log, but occasionally the gateway ip of the graylog container is obtained code show as below:

The code is as follows:

@Override
@Nullable
public Message decode(@Nonnull RawMessage rawMessage) {
    String msg = new String(rawMessage.getPayload(), StandardCharsets.UTF_8);
    LOG.info("decode msg is:{}",msg);
                   
    final ResolvableInetSocketAddress address = rawMessage.getRemoteAddress();
    final InetSocketAddress remoteAddress= address.getInetSocketAddress();

    String  remoteIp = remoteAddress.getAddress().getHostAddress();
    LOG.info(" remoteIp is :{}",remoteIp);
}

2、System environment:
CentOS 7.9
Docker 20.10.3
Graylog 3.3
mongo 3
Elasticsearch - oss 6.8.14

3、Solutions that have been taken:
Uninstall the container, reinstall the deployment solution

4、How can the community help:
Ask if any developers in the community have responded to this problem, and if so, how to completely solve this problem. If not, is there any suggestion that can solve this problem.

Finally, thanks to the graylog team and its developers

Hello && welcome @Archer1003

I’m not a dev, but if you need developers to take a look at this issue like this perhaps post it here would be your best bet.

OK,thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.