Authored by root

Update bigdata inventory file

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 private: no 5 private: no
6 vars: 6 vars:
7 - kafka_hosts: "ops.ckafka.yohoops.org:9092" 7 - kafka_hosts: "ops.ckafka.yohoops.org:9092"
  8 + - config_group: "{{ config_group }}"
8 remote_user: root 9 remote_user: root
9 roles: 10 roles:
10 - role: filebeat 11 - role: filebeat
@@ -2,13 +2,13 @@ @@ -2,13 +2,13 @@
2 # handlers file for filebeat 2 # handlers file for filebeat
3 3
4 - name: stop filebeat 4 - name: stop filebeat
5 - shell: ps aux|grep filebeat-"{{ group }}".yml|grep -v grep|head -n1|awk '{print $2}'|xargs -i kill -9 {} 5 + shell: ps aux|grep filebeat-"{{ config_group }}".yml|grep -v grep|head -n1|awk '{print $2}'|xargs -i kill -9 {}
6 6
7 - name: start filebeat 7 - name: start filebeat
8 - shell: nohup /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat-"{{ group }}".yml -path.data /usr/share/filebeat/bin/data/"{{ group }}" -path.logs /usr/share/filebeat/bin/logs/"{{ group }}"& 8 + shell: nohup /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat-"{{ config_group }}".yml -path.data /usr/share/filebeat/bin/data/"{{ config_group }}" -path.logs /usr/share/filebeat/bin/logs/"{{ config_group }}"&
9 9
10 - name: restart filebeat 10 - name: restart filebeat
11 - shell: ps aux|grep filebeat-"{{ group }}".yml|grep -v grep|head -n1|awk '{print $2}'|xargs -i kill -9 {} ; nohup /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat-"{{ group }}".yml -path.data /usr/share/filebeat/bin/data/"{{ group }}" -path.logs /usr/share/filebeat/bin/logs/"{{ group }}"& 11 + shell: ps aux|grep filebeat-"{{ config_group }}".yml|grep -v grep|head -n1|awk '{print $2}'|xargs -i kill -9 {} ; nohup /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat-"{{ config_group }}".yml -path.data /usr/share/filebeat/bin/data/"{{ config_group }}" -path.logs /usr/share/filebeat/bin/logs/"{{ config_group }}"&
12 12
13 - name: restart filebeat-base 13 - name: restart filebeat-base
14 shell: ps aux|grep filebeat-base.yml|grep -v grep|head -n1|awk '{print $2}'|xargs -i kill -9 {} ; nohup /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat-base.yml -path.data /usr/share/filebeat/bin/data/base -path.logs /usr/share/filebeat/bin/logs/base& 14 shell: ps aux|grep filebeat-base.yml|grep -v grep|head -n1|awk '{print $2}'|xargs -i kill -9 {} ; nohup /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat-base.yml -path.data /usr/share/filebeat/bin/data/base -path.logs /usr/share/filebeat/bin/logs/base&
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 38
39 - name: update filebeat configuration file 39 - name: update filebeat configuration file
40 template: 40 template:
41 - src: "{{ group }}.yml"  
42 - dest: "/etc/filebeat/filebeat-{{ group }}.yml" 41 + src: "{{ config_group }}.yml"
  42 + dest: "/etc/filebeat/filebeat-{{ config_group }}.yml"
43 notify: 43 notify:
44 - restart filebeat 44 - restart filebeat
  1 +filebeat.prospectors:
  2 +- input_type: log
  3 + paths:
  4 + - /Data/logs/nginx/api.yoho.cn_access.log
  5 + document_type: nginx_access
  6 + fields:
  7 + source_ip: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
  8 +{% if dc == 'qcloud-az3' %}
  9 + region: "az3"
  10 +{% elif dc == 'qcloud-az2' %}
  11 + region: "az2"
  12 +{% elif dc == 'qcloud-az1' %}
  13 + region: "az1"
  14 +{% else %}
  15 + region: "unknown"
  16 +{% endif %}
  17 + fields_under_root: true
  18 + tail_files: true
  19 +
  20 +- input_type: log
  21 + paths:
  22 + - /Data/logs/nginx/api.yoho.cn_error.log
  23 + document_type: nginx_access_error
  24 + fields:
  25 + source_ip: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
  26 +{% if dc == 'qcloud-az3' %}
  27 + region: "az3"
  28 +{% elif dc == 'qcloud-az2' %}
  29 + region: "az2"
  30 +{% elif dc == 'qcloud-az1' %}
  31 + region: "az1"
  32 +{% else %}
  33 + region: "unknown"
  34 +{% endif %}
  35 + fields_under_root: true
  36 + tail_files: true
  37 + multiline.pattern: '^\d{4}'
  38 + multiline.negate: true
  39 + multiline.match: after
  40 +
  41 +
  42 +output.logstash:
  43 + hosts: ["10.67.1.192:5044"]