簡體   English   中英

如何使用有效時間格式將FluentD的JSON文件轉發到Graylog2

[英]How to forward a JSON file with FluentD to Graylog2 with a valid time format

我正在使用FluentD和Graylog GELF進行日志記錄,但收效有限。 我想轉發一個JSON文件:

<source>
  @type tail
  path /var/log/suricata/eve.json
  pos_file /var/log/td-agent/suri_eve.pos # pos record
  tag ids
  format json
  # JSON time stamp: 2016-02-01T11:52:49.157072+0000
  # this timestamp is ruby's t.strftime("%Y-%m-%dT%H:%M:%S.%6N%z")
  time_format %Y-%m-%dT%H:%M:%S.%6N%z
  time_key timestamp # I show a JSON message below
</source>

<match **>
  @type graylog
  host 1.2.3.4 #(optional; default="localhost")
  port 12201 #(optional; default=9200)
  flush_interval 30
  num_threads 2
</match>

這會啟動,但會產生錯誤消息:

2016-02-01 15:30:11 +0000 [警告]:plugin / in_tail.rb:263:convert_line_to_event中的救援:“ {\\“ timestamp \\”:\\“ 2016-02-01T15:27:09.000087 + 0000 \\ ” \\ “flow_id \\”:51921072,\\ “EVENT_TYPE \\”:\\ “流\\”,\\ “src_ip \\”:\\ “10.1.1.85 \\”,\\ “src_port \\”:59820,\\ “DEST_IP \\”: \\ “224.0.0.252 \\”,\\ “dest_port \\”:5355,\\ “原\\”:\\ “UDP \\”,\\ “流\\”:{\\ “pkts_toserver \\”:4,\\ “pkts_toclient \\”:0 ,\\ “bytes_toserver \\”:294,\\ “bytes_toclient \\”:0,\\ “啟動\\”:\\ “2016-02-01T15:26:30.393371 + 0000 \\”,\\ “端\\”:\\“2016-02 -01T15:26:37.670904 + 0000 \\“,\\”年齡\\“:7,\\”狀態\\“:\\”新\\“,\\”原因\\“:\\”超時\\“}}”“ error =”無效的時間格式:值= 2016-02-01T15:27:09.000087 + 0000,error_class = ArgumentError,錯誤=無效的strptime格式-'%Y-%m-%dT%H:%M:%S.%6N%z'“

原始消息如下所示:

 {"timestamp":"2016-02-01T15:31:02.000699+0000","flow_id":52015920,"event_type":"flow","src_ip":"10.1.1.44","src_port":49313,"dest_ip":"224.0.0.252","dest_port":5355,"proto":"UDP","flow":{"pkts_toserver":2,"pkts_toclient":0,"bytes_toserver":128,"bytes_toclient":0,"start":"2016-02-01T15:30:31.348568+0000","end":"2016-02-01T15:30:31.759024+0000","age":0,"state":"new","reason":"timeout"}} 

所以我檢查了Ruby文檔 我對FluentD不太熟悉,但是據我所知,時間格式表達式應該適合嗎? 我嘗試過format=none但這也行不通。

https://github.com/Graylog2/graylog2-server/issues/1761

這是Graylog2中具有保留字段(未記錄)的錯誤/問題。 如果您發現帶有時間戳的類似錯誤,請檢查鏈接的問題和開發人員的響應。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM