Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure cloudwatch logs for seedling server #6

Closed
samkeen opened this issue Jul 26, 2015 · 3 comments · Fixed by #27
Closed

Configure cloudwatch logs for seedling server #6

samkeen opened this issue Jul 26, 2015 · 3 comments · Fixed by #27

Comments

@samkeen
Copy link
Owner

samkeen commented Jul 26, 2015

No description provided.

@samkeen
Copy link
Owner Author

samkeen commented Aug 4, 2015

Configuring a running system from AWS's docs

Will then add this to the to be built cf template

Recipe

  1. added this to IAM Role
{
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents",
        "logs:DescribeLogStreams"
    ],
      "Resource": [
        "arn:aws:logs:*:*:*"
    ]
  }
sudo yum update -y
sudo yum install -y awslogs
-------------------------
/etc/awslogs/awscli.conf

[plugins]
cwlogs = cwlogs
[default]
region = us-west-2

-------------------------
/etc/awslogs/awslogs.conf

[general]
state_file = /var/awslogs/state/agent-state

[/var/log/messages]
## Path of log file for the agent to monitor and upload.
file = /home/ec2-user/kiln/logs/app/*.log

## A batch is buffered for buffer-duration amount of time or 32KB of log events.
## Defaults to 5000 ms and its minimum value is 5000 ms.
buffer_duration = 5000

# Use 'end_of_file' to start reading from the end of the file.
# Use 'start_of_file' to start reading from the beginning of the file.
initial_position = start_of_file

## Name of the destination log group.
log_group_name = /kiln/logs/app

## Name of the destination log stream. You may use {hostname} to use target machine's hostname.
log_stream_name = {instance_id}

## Format specifier for timestamp parsing
## ex: 2015-08-03 19:32:02.592545
datetime_format = %Y-%m-%d %H:%M:%S.%f

was getting unable to open database file in logs

Fix

$ sudo mkdir -p /var/awslogs/state

$ sudo service awslogs start
$ sudo chkconfig awslogs on
# check /var/log/awslogs.log for issues

@samkeen
Copy link
Owner Author

samkeen commented Aug 4, 2015

Next, test run: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EC2NewInstanceCWL.html

then take what's learned there and start the CF Template

@samkeen
Copy link
Owner Author

samkeen commented Aug 24, 2015

This needs to go AFTER the run of init-config.php (it creates the files we'll be moving)

## Additions to template

mv /etc/awslogs/awslogs.conf /etc/awslogs/awslogs.conf.stock
mv /etc/awslogs/awscli.conf /etc/awslogs/awscli.conf.stock
mkdir -p /var/awslogs/state

mv /home/ec2-user/kiln/config/cloudwatchLogs/awscli.conf /etc/awslogs/awscli.conf
mv /home/ec2-user/kiln/config/cloudwatchLogs/awslogs.conf /etc/awslogs/awslogs.conf

service awslogs start
chkconfig awslogs on

samkeen added a commit that referenced this issue Aug 24, 2015
- init-config now creates to production files form the templates
- cf-template mv's the files into place on the build maching and
  completes the awslogs install
fixes #6
samkeen added a commit that referenced this issue Aug 24, 2015
added templates for the aws cloudwatch logs config files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant