Skip to content

Instantly share code, notes, and snippets.

@alexjeen
Created July 15, 2020 13:53
Show Gist options
  • Save alexjeen/5195e323bf29ef47836a00e21b2a9d13 to your computer and use it in GitHub Desktop.
Save alexjeen/5195e323bf29ef47836a00e21b2a9d13 to your computer and use it in GitHub Desktop.
logz.io ElasticBeanstalk configuration (send ElasticBeanstalk logs to Logz.io)
files:
"/etc/filebeat/filebeat.yml":
mode: "000755"
owner: root
group: root
content: |
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/cron
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: cron
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 3h
- type: log
enabled: true
paths:
- /var/log/messages
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: message
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 3h
- type: log
enabled: true
paths:
- /var/log/secure
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: secure
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 3h
- type: log
enabled: true
paths:
- /var/log/eb-commandprocessor.log
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: eb-commands
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 3h
- type: log
enabled: true
paths:
- /var/log/eb-activity.log
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: eb-activity
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 24h
- type: log
enabled: true
paths:
- /var/log/httpd/error_log
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: apache-error
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 3h
- type: log
enabled: true
paths:
- /var/log/httpd/access_log
fields:
logzio_codec: plain
token: LOGZIOTOKEN
type: apache
environment: `{"Ref":"AWSEBEnvironmentName"}`
fields_under_root: true
ignore_older: 3h
filebeat.registry.path: /var/lib/filebeat
output:
logstash:
hosts: ["listener-eu.logz.io:5015"]
ssl:
certificate_authorities: ['/etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt']
commands:
1_download_filebeat:
command: "curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.8.0-x86_64.rpm"
cwd: /home/ec2-user
2_install_filebeat:
command: "rpm -ivh --replacepkgs filebeat-7.8.0-x86_64.rpm"
cwd: /home/ec2-user
3_create_cert_dir:
command: "mkdir -p /etc/pki/tls/certs"
cwd: /home/ec2-user
4_install_cert:
command: "sudo curl https://raw.githubusercontent.com/logzio/public-certificates/master/TrustExternalCARoot_and_USERTrustRSAAAACA.crt --create-dirs -o /etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt"
cwd: /etc/pki/tls/certs
5_restart_filebeat:
command: "/etc/init.d/filebeat restart"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment