Skip to content

Commit 0f34923

Browse files
committed
Added: filebeat
1 parent 051bf40 commit 0f34923

8 files changed

Lines changed: 99 additions & 0 deletions

File tree

filebeat/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
run:
2+
sh stop_service.sh && \
3+
rm -fr ./ret/zls_filebeat.txt && \
4+
touch ./ret/zls_filebeat.txt && \
5+
sh start_service.sh
6+
7+
tail:
8+
tail -f ./ret/zls_filebeat.txt

filebeat/config/config.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
CONTAINER_NAME=filebeat
3+
IMAGE=store/elastic/filebeat:7.3.2
4+
LOGSTASH_CONTAINER_NAME=logstash
5+
6+
7+
# ES_IP=localhost
8+
# ES_BACKUP=${PWD}/es_backup
9+
10+
# ES_DATA=${PWD}/data
11+
# ES_CONFIG=${PWD}/config
12+
# ES_PLUGINS=${PWD}/plugins
13+
14+
FILEBEAT_DATA=/tmp/openvpn_filter
15+
export IMAGE
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
filebeat.inputs:
2+
- type: log
3+
enabled: true
4+
paths:
5+
- /logs/ovpn_filter.log
6+
multiline.pattern: '^A'
7+
multiline.negate: true
8+
multiline.match: after
9+
10+
output.logstash:
11+
hosts: ["logstash:5044"]
12+
13+
processors:
14+
- drop_fields:
15+
fields: ["log","host","input","agent","ecs"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
filebeat.inputs:
2+
- type: log
3+
enabled: true
4+
paths:
5+
- /logs/elog_file.log
6+
multiline.pattern: '^A'
7+
multiline.negate: true
8+
multiline.match: after
9+
# 需要收集的日志所在的位置,可使用通配符进行配置
10+
#- /data/elk/*.log
11+
# - /logs/*/*.log
12+
13+
#日志输出配置(采用 logstash 收集日志,5044为logstash端口)
14+
# output.logstash:
15+
# hosts: ['172.17.0.1:5044']
16+
#
17+
# output.file:
18+
# path: "/tmp/ret"
19+
# filename: "zls_filebeat.txt"
20+
21+
output.logstash:
22+
hosts: ["101.230.12.68": 5044]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
filebeat.inputs:
2+
- type: log
3+
enabled: true
4+
paths:
5+
- /logs/ovpn_filter.log
6+
multiline.pattern: '^A'
7+
multiline.negate: true
8+
multiline.match: after
9+
10+
output.logstash:
11+
hosts: ["logstash:5044"]

filebeat/ret/.keep

Whitespace-only changes.

filebeat/start_service.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
source ./config/config.sh
3+
# docker run -p 5044:5044 -p 5045:5045 \
4+
# --name lst -d \
5+
# -v ${PWD}/config/logstash.conf:/usr/share/logstash/config/logstash.conf \
6+
# -v ${PWD}/config/logstash.yml:/usr/share/logstash/config/logstash.yml \
7+
# ${IMAGE} -f /usr/share/logstash/config/logstash.conf
8+
9+
docker run \
10+
--link logstash:logstash \
11+
--restart=always \
12+
--log-driver json-file \
13+
--log-opt max-size=100m \
14+
--log-opt max-file=20 \
15+
--name filebeat \
16+
--user=root -d \
17+
-v ${FILEBEAT_DATA}:/logs/ \
18+
-v ${PWD}/ret:/tmp/ret/ \
19+
-v ${PWD}/config/filebeat.docker.yml:/usr/share/filebeat/filebeat.yml \
20+
${IMAGE}
21+
22+
23+
24+
# -v /etc/localtime:/etc/localtime \
25+
# -v ${PWD}/ret:/tmp/ret/ \

filebeat/stop_service.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
source ./config/config.sh
3+
docker rm -f filebeat

0 commit comments

Comments
 (0)