1

在 Elastic Beanstalk 应用程序(Rails 应用程序)上安装 logstash 转发器以在 Logstash 上转发日志的最佳方法是什么

4

1 回答 1

2

在这里我做了什么,创建配置文件 .ebextensions/02-logstash.config

   files:
          "/etc/yum.repos.d/logstash.repo":
            mode: "000755"
            owner: root
            group: root
            content: |
               [logstash-forwarder]
               name=logstash-forwarder repository
               baseurl=http://packages.elasticsearch.org/logstashforwarder/centos
               gpgcheck=1
               gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
               enabled=1

        commands:
          "100-rpm-key":
            command: "rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch"
          "200-install-logstash-forwarder":
            command: "yum -y install logstash-forwarder"
          "300-install-contrib-plugin":
            command: "rm -rf /etc/logstash-forwarder.conf && cp /var/app/current/logstash-forwarder.conf /etc/ "
            test: "[ ! -f /etc/logstash-forwarder.conf ]"
          "400-copy-cert":
            command: "cp /var/app/current/logstash-forwarder.crt /etc/pki/tls/certs/"
          "500-install-logstash":
            command: "service logstash-forwarder restart"

1:logstash-forwarder.conf

{
    "network": {
        "servers": [
            "logstashIP:5000"
        ],
        "timeout": 15,
        "ssl ca": "/etc/pki/tls/certs/logstash-forwarder.crt"
    },
    "files": [
        {
            "paths": [
                "/var/log/messages",
                "/var/log/secure",
                "/var/log/eb-version-deployment.log",
                "/var/app/support/logs/passenger.log",
                "/var/log/eb-activity.log",
                "/var/log/eb-commandprocessor.log"
            ],
            "fields": {
                "type": "syslog"
            }
        }
    ]
}
于 2015-08-24T14:54:36.110 回答