cookbook 'aws-cloudwatchlogs', '~> 1.1.7'
aws-cloudwatchlogs (7) Versions 1.1.7 Follow2
Install and Configure AWS CloudWatch Logs Agent
cookbook 'aws-cloudwatchlogs', '~> 1.1.7', :supermarket
knife supermarket install aws-cloudwatchlogs
knife supermarket download aws-cloudwatchlogs
AWS CloudWatch Logs Cookbook
Unofficial Chef Cookbook that install and configure AWS CloudWatch Logs
Agent and deploy it's configurations automatically.
Usage
Add this cookbook to your base recipe:
cookbook 'aws-cloudwatchlogs', '~> 1.1.7'
You need to configure the following node attributes via an environment
or role
:
default_attributes( 'aws_cwlogs' => { 'region' => 'your_aws_region', 'aws_access_key_id' => 'your_aws_access_key', 'aws_secret_access_key' => 'your_aws_secret_key', 'log' => { 'syslog' => { 'datetime_format' => '%b %d %H:%M:%S', 'file' => '/var/log/syslog', 'buffer_duration' => '5000', 'log_stream_name' => '{instance_id}', 'initial_position' => 'start_of_file', 'log_group_name' => '/var/log/syslog' } } } )
Or you can also configure by declaring it in another cookbook at a higher precedence level:
default['aws_cwlogs']['region'] = 'your_aws_region' default['aws_cwlogs']['aws_access_key_id'] = 'your_aws_access_key' default['aws_cwlogs']['aws_secret_access_key'] = 'your_aws_secret_key' default['aws_cwlogs']['log']['syslog'] = { 'datetime_format' => '%b %d %H:%M:%S', 'file' => '/var/log/syslog', 'buffer_duration' => '5000', 'log_stream_name' => '{instance_id}', 'initial_position' => 'start_of_file', 'log_group_name' => '/var/log/syslog' }
Note: If you do not specify aws credentials, it will attempt to use the AWS IAM Role assigned to the instance instead.
Once you defined the attributes, you will need to reference aws_cwlogs
resource in your recipe:
include_recipe 'aws-cloudwatchlogs' aws_cwlogs 'syslog' do log node['aws_cwlogs']['log']['syslog'] end aws_cwlogs 'messages' do log node['aws_cwlogs']['log']['messages'] end
This will create a unique configuration file in AWS CloudWatch Logs that will be stored in etc/config
directory.
Remember: You can configure as many logs as you need with log
attribute.
Note: We are not making use of data_bags
for AWS Credentials in this recipe at this time.
Example
Those attributes used before will generate the AWS CloudWatch Logs configuration below:
[syslog] datetime_format = %b %d %H:%M:%S file = /var/log/syslog buffer_duration = 5000 log_stream_name = {instance_id} initial_position = start_of_file log_group_name = /var/log/syslog
For more deployment details about AWS CloudWatch Logs, please visit the AWS CloudWatch Logs Documentation.
Requirements
Platform
- Ubuntu 14.04
Attributes
See attributes/default.rb
for default values.
Recipes
default
This recipe will check if all necessary requirements being met, and after
that will call configure
and install
recipe.
configure
This recipe will prepare and configure all files required by AWS CloudWatch Logs.
install
This recipe will install AWS CloudWatch Logs Agent.
Changes
See CHANGELOG.md
for more details.
License and Author
See LICENSE
for more details.
Trademark
Amazon Web Services and AWS are trademarks of Amazon.com, Inc. or
its affiliates in the United States and/or other countries.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Changes
1.1.7 / 2017-11-21
- Fixed 'service resource not found' error.
- Several improvements for better handling the installation process.
- Added more supported platforms.
1.1.6 / 2017-02-22
- Removed the requirement for
aws_access_key_id
andaws_secret_access_key
attributes values.
1.1.5 / 2017-01-31
- Implementing a better way to handle AWS CloudWatch Logs configurations, now each log has a configuration file that is provisioned via Chef Resources.
1.1.4 / 2016-11-07
- Implementing
logging_config_file
configuration, that overrides the default logging configuration to a WARNING value.
1.1.3 / 2016-10-31
- Fixing
aws_access_key_id
andaws_secret_access_key
attributes values.
1.1.2 / 2016-10-31
- Removing the
log_files
attribute. - Implementing a better logic to handle if the agent is already installed.
1.1.1 / 2016-10-24
- Initial version of
aws-cloudwatchlogs
cookbook.
Collaborator Number Metric
1.1.7 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.1.7 passed this metric
No Binaries Metric
1.1.7 passed this metric
Testing File Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.7 failed this metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.1.7 passed this metric
No Binaries Metric
1.1.7 passed this metric
Testing File Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.7 passed this metric
1.1.7 passed this metric
Testing File Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.7 failed this metric
1.1.7 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number