Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.
Papertrail is an awesome log aggregation service we’ve used for long time. There are many ways to send logs to Papertail service, but we found the following solution is the most straightforward and secure for Rails apps like ours.
gem 'remote_syslog_logger'
config.logger = ActiveSupport::TaggedLogging.new(RemoteSyslogLogger.new("localhost", 514, :program =>))
--- packages: yum: rsyslog-gnutls: [] files: "/etc/rsyslog.d/01-udp.conf": mode: "000640" owner: root group: root content: | $ModLoad imudp $UDPServerRun 514 "/etc/rsyslog.d/02-papertrail-tls.conf": mode: "000640" owner: root group: root content: | $DefaultNetstreamDriverCAFile /etc/papertrail-bundle.pem # trust these CAs $ActionSendStreamDriver gtls # use gtls netstream driver $ActionSendStreamDriverMode 1 # require TLS $ActionSendStreamDriverAuthMode x509/name # authenticate by hostname $ActionSendStreamDriverPermittedPeer *.papertrailapp.com container_commands: 01_copy_ca_certs: command: cp ./.ebextensions/papertrail-bundle.pem /etc/papertrail-bundle.pem 02_install_rsyslog_config: command: /bin/echo "*.* @@${SYSLOG_HOST}" > /etc/rsyslog.d/03-papertrail.conf 03_restart_rsyslog: command: "/sbin/service rsyslog restart"
curl https://papertrailapp.com/tools/papertrail-bundle.pem> .ebextensions/papertrail-bundle.pem
- namespace: aws:elasticbeanstalk:application:environment option_name: SYSLOG_HOST value: logs2.papertrailapp.com:xxxx
Basically the solution can be described as:
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.
Thoughtworks acknowledges the Traditional Owners of the land where we work and live, and their continued connection to Country. We pay our respects to Elders past and present. Aboriginal and Torres Strait Islander peoples were the world's first scientists, technologists, engineers and mathematicians. We celebrate the stories, culture and traditions of Aboriginal and Torres Strait Islander Elders of all communities who also work and live on this land.
As a company, we invite Thoughtworkers to be actively engaged in advancing reconciliation and strengthen their solidarity with the First Peoples of Australia. Since 2019, we have been working with Reconciliation Australia to formalize our commitment and take meaningful action to advance reconciliation. We invite you to review our Reconciliation Action Plan.