mirror of
https://gitea.bearcatlog.com/Bryant/chassis-agent
synced 2025-09-18 02:36:04 +08:00
添加 elk
This commit is contained in:
12
fluentd/Dockerfile
Normal file
12
fluentd/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
# fluentd/Dockerfile
|
||||
FROM bitnami/fluentd:1.16.1-debian-11-r13
|
||||
USER root
|
||||
RUN ["gem", "sources", "--remove", "https://rubygems.org/"]
|
||||
RUN ["gem", "sources", "--add", "https://gems.ruby-china.com/"]
|
||||
RUN ["gem", "sources", "-u"]
|
||||
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--version", "5.3.0"]
|
||||
RUN ["gem", "install", "fluent-plugin-typecast", "--version", "0.2.0"]
|
||||
|
||||
|
||||
|
||||
|
31
fluentd/conf/fluent.conf
Normal file
31
fluentd/conf/fluent.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
# fluentd/conf/fluent.conf
|
||||
<source>
|
||||
@type forward # source表示日志源来自转发,forward与http是默认安装的组件,不需要额外的插件支持。
|
||||
port 24224 # 在24224端口启动forward接收转发
|
||||
bind 0.0.0.0 # 允许接收任意IP的转发
|
||||
</source>
|
||||
|
||||
<match *.**>
|
||||
@type copy
|
||||
<store>
|
||||
@type elasticsearch # 转发日志到es,这需要安装es的插件
|
||||
host elasticsearch # es的配置信息
|
||||
port 9200
|
||||
index_name fluentd
|
||||
logstash_format true # 启动转发
|
||||
logstash_prefix fluentd-${tag} # 转发到es的索引名称
|
||||
logstash_dateformat %Y.%m # 按月来划分索引,可以删除无用数据
|
||||
include_tag_key true
|
||||
type_name application_log
|
||||
tag_key @log_name
|
||||
reconnect_on_error true
|
||||
reload_on_failure true
|
||||
reload_connections false
|
||||
<buffer>
|
||||
flush_interval 2s # 每2s刷新一次
|
||||
</buffer>
|
||||
</store>
|
||||
<store>
|
||||
@type stdout # 搜索到数据后立即转发到es
|
||||
</store>
|
||||
</match>
|
Reference in New Issue
Block a user