Skip to content

Instantly share code, notes, and snippets.

@fbaligand
Last active August 25, 2016 07:12
Show Gist options
  • Save fbaligand/bedeb87a18b876f1d057d43ee171e05c to your computer and use it in GitHub Desktop.
Save fbaligand/bedeb87a18b876f1d057d43ee171e05c to your computer and use it in GitHub Desktop.
package org.logstash.log;
import java.util.Map;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.lookup.StrLookup;
@Plugin(name = "logstash", category = "Lookup")
public class LogstashLookup implements StrLookup {
private static Map<String, String> logstashSettings;
public static void setLogstashSettings(Map<String, String> logstashSettings) {
LogstashLookup.logstashSettings = logstashSettings;
}
public static Map<String, String> getLogstashSettings() {
return logstashSettings;
}
@Override
public String lookup(String key) {
return getLogstashSettings().get(key);
}
@Override
public String lookup(LogEvent event, String key) {
return lookup(key);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment