awslogs_ec2

Ansible Role: AWSLogsEC2

Build Status Ansible Galaxy

This role installs and configures the AWS CloudWatch Logs Agent.

Requirements

This role only requires Ansible version 2.4+ and EC2_FACTS module.

Role Variables


awslogs_logs:
  - file:  /var/log/messages          # The path to the log file you want to ship (required)
    format: "%b %d %H:%M:%S"          # The date and time format of the log file
    time_zone: "LOCAL"                # Timezone, can either be LOCAL or UTC
    initial_position: "start_of_file" # Where log shipping should start from
    group_name: /var/log/messages     # The Cloudwatch Logs group name (required)
    stream_name: "{instance_id}"      # You can use a literal string and/or predefined variables ({instance_id}, {hostname}, {ip_address})

In addition, there are three variables that are not used by default:

awslogs_region: eu-west-1            # Overrides the local region for log shipping

If your instance is behind an HTTP or HTTP proxy, you can configure it with the following variables:

awslogs_enable_proxy: true
awslogs_http_proxy: http://your.proxy:80/
awslogs_https_proxy: http://your.https.proxy:80/
awslogs_noproxy: 169.254.169.254

This configuration is further expanded on in the Amazon Cloudwatch Logs Documentation.

Dependencies

None

Example Playbook

---

- hosts: all

  vars:
    awslogs_region: eu-west-1
    awslogs_logs:
    - file: /var/log/messages
      format: "%b %d %H:%M:%S"
      time_zone: "LOCAL"
      initial_position: "start_of_file"
      group_name: /var/log/messages
      stream_name: "{instance_id}"

  roles:
    - naoyayamamoto.awslogs_ec2

License

MIT / BSD

About

An ansible role to install and configure the AWS CloudWatch Logs for EC2

Install
ansible-galaxy install naoyayamamoto/ansible-role-awslogs-ec2
GitHub repository
License
Unknown
Downloads
61