我在elastic beanstalk上为rails应用程序配置了远程日志记录。我想从/var/log/puma/puma.log
获取日志,但只获取一些内核和系统信息。
这是我的配置文件.ebextensions/papertrail.config
packages:
yum:
rsyslog: []
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
"/etc/rsyslog.d/03-logfile-config.conf":
mode: "000640"
owner: root
group: root
content: |
$ModLoad imfile
$InputFileName /var/log/puma/puma.log
$InputFileTag api
$InputFileStateFile api-staging
$InputFileSeverity error
$InputFileFacility local3
$InputRunFileMonitor
"/etc/rsyslog.d/04-papertrail.conf":
mode: "000640"
owner: root
group: root
content: |
$LocalHostName api-staging
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/04-papertrail.conf'
03_restart_rsyslog:
command: 'sudo service rsyslog restart'
但我在Papertrail上只能获取到一些信息,例如:
Nov 03 21:28:00 api-staging kernel: imklog 5.8.10, log source = /proc/kmsg started.
Nov 03 21:28:00 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="32340" x-info="http://www.rsyslog.com"] start
Nov 03 23:50:41 api-staging kernel: Kernel logging (proc) stopped.
Nov 03 23:50:41 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="32340" x-info="http://www.rsyslog.com"] exiting on signal 15.
Nov 04 00:51:56 api-staging kernel: imklog 5.8.10, log source = /proc/kmsg started.
Nov 04 00:51:56 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="15883" x-info="http://www.rsyslog.com"] start
Nov 04 00:53:42 api-staging kernel: Kernel logging (proc) stopped.
如果您对这个问题有经验,请帮助我。谢谢!