Commit 9622a855 by ChongmingDu

Add filebeat

parent 0159629c
[local] [local]
local1 local1 hostname=local1
[zabbix_server] [zabbix_server]
web1 web1
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
user: user:
name: tomcat name: tomcat
shell: /bin/bash shell: /bin/bash
password: 1q2w3e4r password: kk1q2w3e4r
remove: yes remove: yes
- name: "Install git 2.9.5" - name: "Install git 2.9.5"
...@@ -23,4 +23,7 @@ ...@@ -23,4 +23,7 @@
shell: "cd /usr/local/;tar -xvf git-2.9.5.tar.xz" shell: "cd /usr/local/;tar -xvf git-2.9.5.tar.xz"
- name: "Install git" - name: "Install git"
shell: "cd /usr/local/git-2.9.5/;./configure --prefix=/usr &>/dev/null;make -j 4&& make install &>/dev/null" shell: "cd /usr/local/git-2.9.5/;./configure --prefix=/usr &>/dev/null;make -j 4&& make install &>/dev/null"
\ No newline at end of file
- name: "set hostname"
raw: hostnamectl set-hostname "{{hostname|quote}}"
\ No newline at end of file
---
- name: "restart filebeat"
service: name=filebeat state=restarted enabled=yes
\ No newline at end of file
- name: Install elastic repo
yum:
name: https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.6.12-x86_64.rpm
state: present
- name: Install filebeat 5.6.12
yum:
name: filebeat
state: present
- name: copy filebeat templates
template:
src: filebeat.yml
dest: /etc/filebeat/filebeat.yml
notify:
- restart filebeat
\ No newline at end of file
filebeat.prospectors:
- input_type: log
paths:
- /opt/tomcat/test-base-service/logs/base-service/base-service.log
multiline:
pattern: ^\d{4}\.\d{2}.\d{2}
negate: true
match: after
fields:
doc_type: crmtest-base-service
output.elasticsearch:
hosts: ["172.16.162.209:9200"]
index: "crmtest-%{+yyyy.MM.dd}"
indices:
- index: "crmtest-base-service-%{+yyyy.MM.dd}"
when.contains:
source: "/opt/tomcat/test-base-service/logs/base-service/base-service.log"
protocol: "http"
username: "elastic"
password: "changeme"
\ No newline at end of file
...@@ -7,7 +7,7 @@ LogFileSize=0 ...@@ -7,7 +7,7 @@ LogFileSize=0
##### Passive checks related ##### Passive checks related
Server=127.0.0.1 Server=172.16.162.209
### Option: ServerActive ### Option: ServerActive
......
...@@ -8,4 +8,6 @@ ...@@ -8,4 +8,6 @@
roles: roles:
- base - base
- nginx - nginx
\ No newline at end of file - zabbix_agent
- filebeat
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment