A BOSH release to help you ingest, parse, and visualize your AWS logs.
We can currently handle these log types...
We rely a process flow which looks like...
- AWS dumps a new log into your S3 bucket
- Your S3 bucket sends a notification to a SQS topic about it
- The
s3-notification
job waits for messages on that SQS topic - It downloads the log file from S3 and normalizes the contents
- Events get pushed into the redis queue
- Your regular logsearch cluster takes care of the rest
We like this setup because...
- can continue adding support for all the AWS log formats
- can reuse our existing logsearch infrastructure for parsing and searching log events
- using a queue is much more scalable than watching entire bucket paths for new files
Before getting started, you must set up the following in AWS...
- IAM credentials which allow working off the queue and downloading the referenced S3 files (sample)
- Separate SQS Queues and S3 Notifications for the log types and files you use (sample)
Fetch and install our logsearch configuration (details)...
$ wget -O- https://logsearch-for-aws-boshrelease.s3.amazonaws.com/release/latest/logsearch-config.tgz | tar -xz
$ open \
logsearch-config/logs/elasticsearch-mappings.json \
logsearch-config/logs/logstash-filters.conf
...snip...
Upload the release to your director...
$ bosh upload release https://logsearch-for-aws-boshrelease.s3.amazonaws.com/release/latest/tarball.tgz
Update your deployment to add the release, templates, and properties...
releases:
...snip...
- name: "logsearch-for-aws"
version: "latest"
jobs:
- name: "l4aws"
templates:
...snip...
- release: "logsearch-for-aws"
name: "s3-notification"
properties:
...snip...
l4aws:
access_key_id: "...snip..."
secret_access_key: "...snip..."
s3_notification:
queues:
# [ queue region , queue name , log format type ]
- [ "us-east-1" , "l4aws-billing" , "billing" ]
- [ "us-east-1" , "l4aws-cloudtrail" , "cloudtrail" ]
- [ "us-east-1" , "l4aws-s3" , "s3" ]
If you want to add parsing for a new log type... here are the things you should keep in mind...
- Update
s3-notification
job templates...config/logstash.conf.erb
- add it to the list used to createfile
inputsbin/main_ctl
- add it to the list used tomkdir
directorieslogsearch/logs.yml
- add a dummy entry to ensure the logsearch-config reference is active
- Create
src/scripts/transform-{aws-log-format-name}
which will convert the raw S3 log file format into a single event per line. - Implement the filtering configuration in
src/logsearch-config/logs/{aws-log-format-name}
...- Write
{aws-log-format-name}
toname
- Write your test data and expectations to
expected.testdata
- Write your logstash filter configurations to
logstash-filters.conf
- Write your elasticsearch mapping configurations to
elasticsearch-mapping.json
- Write
- Update
src/aws-helper/s3-sns-sqs/generator/regenerate.sh
(and then execute) to add the new log type. - Update
src/aws-helper/iam/sample-policy.json
to add the new sample directory (if applicable). - Update
README.md
to add the log file format to our list of supported logs.
Once updated, run ./bin/logsearch-config
to test your log parsing filters and generate new configuration in ./logsearch-config
. Use those configuration files in your test environment and verify your new log runs through the whole process.
Share your work with a Pull Request :)
- Replay Helper - (fairly) easy way to replay some old logs into the queues for re-analysis