悟空,拿我的打狗棒来

java logstash自定义输出控件 参数问题

Logstash | 作者 yu89780012 | 发布于2019年09月19日 | 阅读数:2475

如下图所示 , 我在这定义了 HOSTNAME  和 PORT 两个参数
@LogstashPlugin(name = "java_output_example")
public class JavaOutputExample implements Output {

public static final PluginConfigSpec<String> PREFIX_CONFIG =
PluginConfigSpec.stringSetting("prefix", "");

public static final PluginConfigSpec<String> HOSTNAME =
PluginConfigSpec.stringSetting("hostname", "192.168.43.17");

public static final PluginConfigSpec<String> PORT =
PluginConfigSpec.stringSetting("port", "26666");

private final String id;
private String prefix;
private PrintStream printer;
private final CountDownLatch done = new CountDownLatch(1);
private volatile boolean stopped = false;

// 定义转发参数
private String hostname;
private String port;
private TcpClient tcpClient;


// all plugins must provide a constructor that accepts id, Configuration, and Context
public JavaOutputExample(final String id, final Configuration configuration, final Context context) {
this(id, configuration, context, null);
}

JavaOutputExample(final String id, final Configuration config, final Context context, OutputStream targetStream) {
// constructors should validate configuration options
this.id = id;
prefix = config.get(PREFIX_CONFIG);
// 初始化相应参数
hostname = config.get(HOSTNAME);
port = config.get(PORT);
tcpClient = new TcpClient(hostname, Integer.valueOf(port));
tcpClient.connect();
}
然后 ,我在使用控件的时候

121212.png

 
但是在验证过程中,出现

QQ截图20190919111057.png

 
这个是什么原因呢。。求各位大佬解答
已邀请:

yu89780012

赞同来自:

QQ截图20190920141214.png


QQ截图20190920141234.png

 
问题已处理,两处均需要定义。

要回复问题请先登录注册