Trying to log remote ip through plugin unsuccessfully



I have an elasticsearch cluster version 5.6.2.
I'm trying to log the remote ip that initiated the request.
For some reason when I try logging the ip I get null value.

Here is my plugin class:

public class RiemannLoggerPlugin extends Plugin implements ActionPlugin {

private static final String SETTING_DISABLE = "riemann.logger.disable";

private final Logger log = Loggers.getLogger(RiemannLoggerPlugin.class);
//private final boolean enabled;

public RiemannLoggerPlugin(Settings settings) {"Starting Riemann Logger Plugin");

public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
                                         IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
                                         IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
    ArrayList<RestHandler> restHandlers = new ArrayList<>(1);
    restHandlers.add(new RiemannLoggerRestHandler());
    return restHandlers;

public List<Setting<?>> getSettings() {
    List<Setting<?>> settings = new ArrayList<>();
    settings.add(Setting.simpleString(SETTING_DISABLE, Setting.Property.NodeScope));
    return settings;

public List<Class<? extends ActionFilter>> getActionFilters() {
    ArrayList<Class<? extends ActionFilter>> filters = new ArrayList<>();
    return filters;

public class RiemannLoggerActionFilter extends ActionFilter.Simple {

private static final Logger log = LogManager.getLogger(RiemannLoggerActionFilter.class);

public RiemannLoggerActionFilter(Settings settings) {

public int order() {
    return Integer.MIN_VALUE;

protected boolean apply(String action, ActionRequest request, ActionListener<?> listener) {"Woohoo! got a request from: " + request.remoteAddress());"Action: " + action);"Listener:" + listener.toString());
    return true;

Example log:
[2017-10-22T11:19:22,851][INFO ][c.f.e.r.RiemannLoggerActionFilter] Woohoo! got a request from: null
[2017-10-22T11:19:22,851][INFO ][c.f.e.r.RiemannLoggerActionFilter] Action: indices:data/read/mget
[2017-10-22T11:19:22,852][INFO ][c.f.e.r.RiemannLoggerActionFilter]$1@1924d1bb


(system) #2

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