Code Monkey home page Code Monkey logo

ansible-filebeat's Introduction

Ansible Filebeat role

Ansible Galaxy Travis

Installs Elastic's Filebeat for forwarding logs.

Role Variables

  • filebeat_version - The version of filebeat to install. Defaults to 6.4.2.
  • filebeat_state - Defaults to present. Set it to absent to uninstall filebeat.
  • filebeat_config - YAML representation of your filebeat config. This is templated directly into the configuration file as YAML. See the example configuration for an exhaustive list of configuration options. Defaults to:
filebeat_config:
  filebeat:
    prospectors:
      - paths:
          - /var/log/messages
          - /var/log/*.log
        input_type: log
  output:
    file:
      path: /tmp/filebeat
      filename: filebeat
  logging:
    to_syslog: true
    level: error
  • filebeat_ca_cert - If provided, the contents of this variable will be placed into the file identified by filebeat_ca_path on the target host. You can then include the filebeat_ca_path within your configuration to properly authenticate your TLS connections to Logstash/Elasticsearch/etc.

If you wish to load your CA certificate from a file, use the file lookup plugin, e.g.:

filebeat_ca_cert: "{{ lookup('file', '/path/to/ca.crt') }}"
  • filebeat_ca_path - If a CA certificate is provided in filebeat_ca_cert, it will be created at this path.

Similar to the CA variables, you can upload SSL certificates and keys for filebeat using these variables:

  • filebeat_ssl_cert - Contents of the SSL certificate
  • filebeat_ssl_cert_path - Destination of the certificate on the Ansible controlled host
  • filebeat_ssl_key - Contents of the SSL key
  • filebeat_ssl_key_path - Destination of the SSL key on the Ansible controlled host

You can also store the config in separate filebeat.yml file and include it using lookup:

filebeat_config: "{{ lookup('file', './filebeat.yml')|from_yaml }}"

Common Configurations

Connecting to Elasticsearch:

filebeat_config:
  filebeat:
    prospectors:
      - paths:
          - /var/log/messages
          - /var/log/*.log
        input_type: log
  output:
    elasticsearch:
      hosts:
        - "http://localhost:9200"
      username: "bob"
      password: "12345"
  logging:
    to_syslog: true
    level: error

License

BSD

Author Information

David Wittman

ansible-filebeat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-filebeat's Issues

yml files clash when filesystem is not case-sensitive

fatal: [x.x.x.x]: FAILED! => {"failed": true, "msg": "/usr/local/etc/ansible/roles/DavidWittman.filebeat/tasks/RedHat.yml must be stored as a dictionary/hash"}

This happens on OS X, because HFS+ is not (by default) case-sensitive. Changing the names of the task yml files fixes the issue.

Need helps to use this role to set different setting for different host

Suppose I have three applications: web, app and database. How can I create three different profiles with same DavidWittman/ansible-filebeat role?

For example, I define a var file as below which will be applied to all servers (common role)

filebeat_config:
    filebeat:
      prospectors:
        - paths:
            - /var/log/messages
            - /var/log/secure
            - /var/log/*.log
          document_type: syslog
          fields:
             type: syslog
    output:
      elasticsearch:
        hosts:
          - logstash01:6782
          - logstash02:6782
        timeout: 15
        tls: 
          certificate_authorities:
             - /etc/pki/tls/certs/logstash_cert.crt
          certificate: /etc/pki/tls/certs/logstash_cert.crt
          certificate_key: /etc/pki/tls/private/logstash_key.crt
    logging:
      to_syslog: true
      level: error

Then I need define a new filebeat config to support type of apache for web servers only, what can I do ?

filebeat.yml is not generated properly with multiline ansible_managed

Hi,

Ansible 2.0 support multiline ansible_managed but seems to_yaml filter does not correctly work in this case.

Example:

cat /etc/filebeat/filebeat.yml 
# This file managed by Ansible.

Do not edit it manually.
All changes will be overwritten.
Thank you.

filebeat:
  prospectors:
  - document_type: apache
...

template file name is wrong when using ansible-galaxy install

Not quite sure if it is this galaxy module problem but when I install it using galaxy the template file name is .yml.j2 rather than filebeat.yml.j2 which causes error when using the role.

My requirements file is like this and I ran the command specified in the first comment line.

cat requirements.yml

run like this ansible-galaxy --roles-path roles/ install -r requirements.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.