From da8db23432fc022f1d7d86200b26830a18f862c2 Mon Sep 17 00:00:00 2001 From: Leif Madsen Date: Thu, 18 Aug 2016 08:39:02 -0400 Subject: [PATCH] Add filebeat functionality --- filebeat.yml | 16 ++++++++++++++++ requirements.yml | 1 + site.yml | 3 +++ vars/main.yml | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 filebeat.yml diff --git a/filebeat.yml b/filebeat.yml new file mode 100644 index 0000000..ae2beff --- /dev/null +++ b/filebeat.yml @@ -0,0 +1,16 @@ +# vim: ft=ansible +--- + +# Deploy Jenkins Master +- hosts: jenkins_master + tags: + - jenkins_master + - logging + + vars_files: + - "{{ inventory_dir }}/../vars/main.yml" + - ~/.ansible/vars/cira_vars.yml + + roles: + - { role: 'torian.filebeat' } + diff --git a/requirements.yml b/requirements.yml index f1e1a12..f686b63 100644 --- a/requirements.yml +++ b/requirements.yml @@ -15,3 +15,4 @@ version: master name: leifmadsen.jenkins-job-builder - src: franklinkim.sudo +- src: torian.filebeat diff --git a/site.yml b/site.yml index 42cb241..058548b 100644 --- a/site.yml +++ b/site.yml @@ -12,6 +12,9 @@ # Include the ELK stack playbook - include: elk.yml +# Include FileBeat setup +- include: filebeat.yml + # Section that provides post-installation information - hosts: kibana tags: diff --git a/vars/main.yml b/vars/main.yml index c4e93d6..9407b1f 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,6 +1,7 @@ # Variables setup for use in site.yml run. # Use host_vars/ or group_vars/ for openstack.yml setup. +# Jenkins Master Configuration jenkins_master_server_name: ci.example.tld jenkins_master_nginx_access_log: /var/log/nginx/jenkins.access.log jenkins_master_ssh_directory: /var/lib/jenkins/.ssh/ @@ -15,18 +16,54 @@ jenkins_plugins: - copy-to-slave jenkins_scp_sites: [] +# JJB Configuration jenkins_job_builder_config_jenkins_url: http://localhost:8080 jenkins_job_builder_file_jobs_src: ./files/jobs jenkins_job_builder_config_job_builder_recursive: True jenkins_job_config_file_src: /var/lib/jenkins/userContent/config jenkins_job_builder_handler_check_retries: 10 +# Logstash Configuration logstash_configuration_files: - 03-beats.conf +# ElasticSearch configuration elasticsearch_script_inline: false elasticsearch_script_index: false elasticsearch_http_port: 9200 elasticsearch_network_address: "{{ hostvars['elasticsearch']['ansible_eth0']['ipv4']['address'] }}" elasticsearch_url: http://{{ elasticsearch_network_address }}:{{ elasticsearch_http_port }} elasticsearch_network_host: 0.0.0.0 + +# FileBeat configuration +filebeat_user: root +filebeat_group: root +filebeat_create_user: false +filebeat_version: 1.2.3 +filebeat_start_at_boot: true +filebeat_config_file: /etc/filebeat/filebeat.yml +filebeat_config_prospectors: | + filebeat: + prospectors: + - + paths: + - {{ jenkins_master_results_directory }}/**/**/job_*.log + input_type: log + document_type: "ansible" + include_lines: [ '(^PLAY RECAP.+)', '(^TASK.+)', '(^task path.+)', '(Monday)|(Tuesday)|(Wednesday)|(Thursday)|(Friday)|(Saturday)|(Sunday)', '(^ok\:.+)', '(^skipping\:.+)', '(^failed\:.+)', '(^included\:.+)', '(^changed\:.+)' ] + registry_file: "{{ filebeat_config_registry_file }}" + +filebeat_config_output: | + output: + logstash: + hosts: ["{{ hostvars['logstash']['ansible_eth0']['ipv4']['address'] }}:5044"] + +filebeat_config_logging: | + logging: + level: debug + to_files: true + to_syslog: false + files: + path: /var/log/mybeat + name: mybeat.log + keepfiles: 7