gpt4 book ai didi

amazon-web-services - 如何在 Elastic Beanstalk Multicontainer docker 上使用 fluentd 日志驱动程序

转载 作者:行者123 更新时间:2023-12-04 08:00:45 26 4
gpt4 key购买 nike

我尝试将 fluentd 日志驱动程序与以下 Dockerrun.aws.json 一起使用,

    {      "AWSEBDockerrunVersion": 2,      "containerDefinitions": [        {          "name": "apache",          "image": "php:5.6-apache",          "essential": true,          "memory": 128,          "portMappings": [            {              "hostPort": 80,              "containerPort": 80            }          ],          "logConfiguration": {            "logDriver": "fluentd",            "options": {              "fluentd-address": "127.0.0.1:24224"            }          }        }      ]    }

but the following error occurred.

ERROR: Encountered error starting new ECS task: {cancel the command.
"failures": [
{
"reason": "ATTRIBUTE",
"arn": "arn:aws:ecs:ap-northeast-1:000000000000:container-instance/00000000-0000-0000-0000-000000000000"
}
],
"tasks": []
}
ERROR: Failed to start ECS task after retrying 2 times.
ERROR: [Instance: i-00000000] Command failed on instance. Return code: 1 Output: beanstalk/hooks/appdeploy/enact/03start-task.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

我应该配置什么灵魂?

最佳答案

似乎您也可以使用应用程序环境目录中的 .ebextensions/01-fluentd.config 文件来完成它,其中包含以下内容:

files:
"/home/ec2-user/setup-available-log-dirvers.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/sh
set -e
if ! grep fluentd /etc/ecs/ecs.config &> /dev/null
then
echo 'ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","syslog","fluentd"]' >> /etc/ecs/ecs.config
fi

container_commands:
01-configure-fluentd:
command: /home/ec2-user/setup-available-log-dirvers.sh

现在你必须部署一个新的应用程序版本(还没有 fluentd 配置),重建你的环境,添加 fluentd 配置:

  logConfiguration:
logDriver: fluentd
options:
fluentd-address: localhost:24224
fluentd-tag: docker.myapp

现在部署更新的应用程序,现在一切都应该工作了。

关于amazon-web-services - 如何在 Elastic Beanstalk Multicontainer docker 上使用 fluentd 日志驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35789111/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com