Fluentd

如何在fluentd中將單個記錄拆分為多個記錄?

  • September 9, 2016

我想問一下關於流利的問題。

我的流利版本如下。

td-agent-2.1.5-0.x86_64
fluentd 0.10.61

我現在有一個使用多行格式的尾部輸入外掛,它從日誌中解析多行並設置為一條記錄,如下所示。

2016-07-31T14:48:06+09:00       arm       {"val1":"15:49:18.602384","val2":"5009","val3":"4896","val4":"3905","val5":"1811","val6":"10287","val7":"10271","val8":"1509","val9":"11064","val10":"10832","val11":"10673","val12":"9553","val13":"10660","val14":"9542","val15":"15:49:18.602509","val16":"3759","val17":"4758","val18":"2930","val19":"1261","val20":"7761","val21":"7767","val22":"1023","val23":"7905","val24":"7711","val25":"7918","val26":"7292","val27":"7940","val28":"6907"}

我需要將所有欄位從 1 條記錄拆分為 28 條記錄,以便彈性搜尋將其辨識為不同的文件。

像 ,

val1

val2

val3

val28

有沒有辦法在流利的配置中實現這一點?也許,嵌入紅寶石程式碼?

最好的問候, Yu Watanabe

您需要提供一個正則表達式來分別解析欄位並將日誌消息的 json 部分設置為欄位message,並且時間戳應該儲存在該欄位中,time或者@timestamp它應該按您的預期工作,其中 ElasticSearch 會自動解釋 json 有效負載。

引用自:https://serverfault.com/questions/792945