curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
编辑Fluent的配置文件
vim /etc/fluent-bit/fluent-bit.conf
将INPUT和OUTPUT替换如下
[INPUT]
Name tail
Path /home/xxx/xx/*.log
Buffer_Chunk_Size 2m
Buffer_Max_Size 30m
Mem_Buf_Limit 32MB
storage.type filesystem
Skip_Long_Lines on
Path_Key filename
[INPUT]
Name tail
Path /home/xxx/*.log
Buffer_Chunk_Size 2m
Buffer_Max_Size 30m
Mem_Buf_Limit 32MB
storage.type filesystem
Skip_Long_Lines on
Path_Key filename
[OUTPUT]
Name es
Match *
Host 192.168.130.166
Port 9200
HTTP_User elastic
HTTP_Passwd xxxxxxxxxxxxxxxxx
Index my_index
Type _doc
Logstash_Format On
Logstash_DateFormat %Y.%m.%d
Logstash_Prefix_Key wit-logging-smart-extra
Logstash_Prefix wit-logging-smart-extra
Trace_Error On
Retry_Limit 2
[SERVICE]
storage.path /var/log/flb-storage/
storage.sync normal
storage.checksum off
storage.backlog.mem_limit 512M
[FILTER]
Name parser
Match *
Reserve_Data On
Key_Name log
Parser wit-parking-logs
[FILTER]
Name record_modifier
Match *
Record hostname ${HOSTNAME}[FILTER]
Name Lua
Match *
script log_substring.lua
call sublog