我正在嘗試將日志從基本的 java maven 項(xiàng)目發(fā)送到遠(yuǎn)程機(jī)器上配置的 fluent-bit。Fluent-bit 然后會(huì)將它們寫入文件。這是我的基本java配置。爪哇private final static Logger logger = LoggerFactory.getLogger(App.class);public static void main(String[] args) { for (int i = 0; ; i++) { logger.debug("Warn msg"); try { Thread.sleep(5000); } catch (InterruptedException e) { // do nothing now } }}和 logback.xml<appender name="fluentd" class="ch.qos.logback.more.appenders.DataFluentAppender"> <remoteHost>xx.xxx.xxx.xxx</remoteHost> <port>7777</port> <encoder> <pattern>%message%n</pattern> </encoder></appender><root level="DEBUG"> <appender-ref ref="fluentd" /></root>流暢的位配置:td-agent-bit.conf[INPUT] Name tcp Listen xx.xxx.xxx.xxx Port 7777 Parsers_File /etc/td-agent-bit/parsers.conf Parser custom_parser[OUTPUT] Name file Match * Path /home/td-agent-bit/output.txt解析器配置文件[PARSER] Name custom_parser Format regex Regex .*應(yīng)用程序運(yùn)行時(shí),我不斷收到以下異常[2018/09/27 08:29:13] [trace] [in_tcp] read()=74 pre_len=370 now_len=444[2018/09/27 08:29:13] [debug] [in_serial] 無效的 JSON 消息,跳過但是當(dāng)我嘗試通過命令行測(cè)試配置時(shí),它可以工作echo '{"key 1": 10, "key 2": "YYY"}' | nc xx.xxx.xxx.xxx 7777我沒有任何異常,輸出文件具有所有權(quán)限。遠(yuǎn)程機(jī)器也是基于光子操作系統(tǒng)的系統(tǒng)。任何想法將不勝感激。
添加回答
舉報(bào)
0/150
提交
取消