Last active
February 24, 2019 01:10
-
-
Save binarylogic/26f97f4ef3589bdbdd14e65fd4c002a8 to your computer and use it in GitHub Desktop.
Timber.io AWS ElasticBeanstalk configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# | |
# Installation configuration script for sending logs to Timber using fluent-bit | |
# | |
# * Docs: https://timber.io/docs/platforms/aws-elastic-beanstalk | |
# * Support: support@timber.io | |
# | |
# To use this file: | |
# | |
# *Note:* The in-app instructions will offer copy/paste step-by-step | |
# instructions that are easier to follow. You can setup your app at | |
# https://app.timber.io | |
# | |
# 1. Add this file to the `.ebextensions` directory in your project folder. | |
# 2. Set the environment variable "TIMBER_API_KEY" using `eb setenv`. | |
# 3. By default, this will ship the EB logs, but you can add additional [Tail] inputs below. | |
# Unsure which files to track? See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html#health-logs-instancelocation | |
# See https://docs.fluentbit.io/manual/input/tail for [Tail] input options. | |
# | |
--- | |
files: | |
# needed for custom td-agent-bit with sysv init script | |
"/etc/yum.repos.d/timber.repo": | |
mode: "000640" | |
owner: root | |
group: root | |
encoding: plain | |
content: | | |
[timberio_packages] | |
name=timberio_packages | |
baseurl=https://packagecloud.io/timberio/packages/el/7/$basearch | |
repo_gpgcheck=1 | |
gpgcheck=0 | |
enabled=1 | |
gpgkey=https://packagecloud.io/timberio/packages/gpgkey | |
sslverify=1 | |
sslcacert=/etc/pki/tls/certs/ca-bundle.crt | |
metadata_expire=300 | |
[timberio_packages-source] | |
name=timberio_packages-source | |
baseurl=https://packagecloud.io/timberio/packages/el/7/SRPMS | |
repo_gpgcheck=1 | |
gpgcheck=0 | |
enabled=1 | |
gpgkey=https://packagecloud.io/timberio/packages/gpgkey sslverify=1 | |
sslcacert=/etc/pki/tls/certs/ca-bundle.crt | |
metadata_expire=300 | |
"/tmp/td-agent-bit.conf": | |
mode: "000640" | |
owner: root | |
group: root | |
encoding: plain | |
content: | | |
[SERVICE] | |
# Flush | |
# ===== | |
# Set an interval of seconds before to flush records to a destination | |
Flush 5 | |
# Log_Level | |
# ========= | |
# Set the verbosity level of the service, values can be: | |
# | |
# - error | |
# - warning | |
# - info | |
# - debug | |
# - trace | |
# | |
# By default 'info' is set, that means it includes 'error' and 'warning'. | |
Log_Level info | |
# Parsers_File | |
# ============ | |
# Specify an optional 'Parsers' configuration file | |
Parsers_File parsers.conf | |
# Plugins_File plugins.conf | |
# HTTP Server | |
# =========== | |
# Enable/Disable the built-in HTTP Server for metrics | |
HTTP_Server Off | |
HTTP_Listen 0.0.0.0 | |
HTTP_Port 2020 | |
[INPUT] | |
Name tail | |
Path /var/log/eb-* | |
Path_Key file | |
DB /var/spool/td-agent-bit/eb-logs.db | |
# Send all input logs to Timber | |
[OUTPUT] | |
Name http | |
Match * | |
Host logs.timber.io | |
Port 443 | |
URI /sources/`{ "Fn::GetOptionSetting" : { "Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "TIMBER_SOURCE_ID" } }`/frames | |
Format json | |
header_tag FLUENT-TAG | |
Header Authorization Bearer `{ "Fn::GetOptionSetting" : { "Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "TIMBER_API_KEY" } }` | |
TLS On | |
commands: | |
00_install_fluentbit: | |
command: "yum install -y td-agent-bit" | |
01_chkconfig: | |
command: "/sbin/chkconfig td-agent-bit on" | |
# package installs this file, so we write it to another location and copy | |
02_install_config: | |
command: "mv /tmp/td-agent-bit.conf /etc/td-agent-bit/td-agent-bit.conf" | |
03_created_db_directory: | |
command: "mkdir -p /var/spool/td-agent-bit" | |
03_start_service: | |
command: "/sbin/service td-agent-bit restart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment