flnentd
Fluentd
1.sursen-admin fluentd
<source>
@type tail
path /var/log/nohup.out
pos_file /var/log/nohup.out.pos
tag fluentd
refresh_interval 1
<parse>
@type none
</parse>
</source>
<match>
@type elasticsearch
host 150.138.84.21
port 9200
logstash_format true
logstash_prefix ${tag}
logstash_dateformat %Y%m%d
request_timeout 15s
flush_interval 1s
</match>
2.dockerfile
FROM fluent/fluentd:v1.12.0-debian-1.0
USER root
RUN ["gem", "install", "elasticsearch", "--no-document", "--version", "7.10.1"]
RUN gem install excon -v 0.109.0
RUN ["gem", "install", "fluent-plugin-elasticsearch", "--no-document", "--version", "5.0.3"]
USER root
3.docker-compose
version: '3'
services:
server-fluentd:
image: registry.cn-beijing.aliyuncs.com/yyb-ricky/fluentd:7.10.1
container_name: server-fluentd
ports:
- "24224:24224"
restart: always
privileged: true
environment:
- FLUENTD_CONF=fluentd.conf
- TZ=Asia/Shanghai
volumes:
- ./nohup.out:/var/log/nohup.out
- ./fluentd.conf:/fluentd/etc/fluentd.conf