Installs and configure awslogs-agent
Tested on Ubuntu 14.04
Key | Type | Description | Default |
---|---|---|---|
['awslogs-agent']['region'] | String | AWS region | us-east-1 |
['awslogs-agent']['databag'] | String | Databag where the AWS credentials are stored | nil-east-1 |
['awslogs-agent']['version'] | String | Version of the awslogs-cwlogs pip package | 1.3.1 |
['awslogs-agent']['streams'] | String | Logs streams to be pushed | {} |
['awslogs-agent']['path'] | String | Installation path | /var/awslogs |
['awslogs-agent']['plugin_url'] | String | Location to download awslogs-cwlogs from | http://aws-cloudwatch.s3-website-us-east-1.amazonaws.com |
Include awslogs-agent
in your node's run_list
:
{
"run_list": [
"recipe[awslogs-agent::default]"
]
}
The creation of log streams is attribute-driven using the node['awslogs_agent']['streams'] hash. For example to push the /var/log/syslog:
"awslogs_agent": {
"streams": {
"syslog": {
"file": "/var/log/syslog",
"log_group_name": "/var/log/syslog",
"datetime_format": "%Y-%m-%d %H:%M:%S",
"log_stream_name": "{instance_id}"
}
}
}
To read AWS credentials from a databag set the node['awslogs_agent']['databag'], and create an item like:
{
"id": "main",
"aws_access_key_id": "YOUR_ACCESS_KEY",
"aws_secret_access_key": "YOUR_SECRET_ACCESS_KEY",
"aws_session_token": "YOUR_SESSION_TOKEN"
}
Usage of AWS credentials is hightly discourage thought, and using a IAM role is the recommended solution.
Author:: YOUR_NAME (<YOUR_EMAIL>)