Ich habe eine Elastic Beanstalk-Anwendung mit einem Docker-Container bereitgestellt. Die Anwendung selbst ist eine Java-Anwendung.Elastische Bohnenstange Docker mit Amazon CloudWatch
Mein Ziel ist es, die Protokolle zu Cloudwatch zu bekommen. Insbesondere möchte ich die stdouterr.log Datei zu Cloudwatch bekommen. Die Datei finden Sie unter /var/log/eb-docker/containers/eb-current-app/*
Ich folgte der offiziellen AWS-Dokumentation here. Basierend auf den Beispielkonfigurationsdateien konnte ich den nginx Webrequest zu Cloudwatch bringen.
Für die Docker EB I stdouterr log angepasst ist, die CWL-log-setup.config Datei auf die folgenden:
Mappings:
CWLogs:
ApplicationLogGroup:
LogFile: "/var/log/eb-docker/containers/eb-current-app/*"
TimestampFormat: "%d/%b/%Y:%H:%M:%S %z"
Outputs:
ApplicationLogGroup:
Description: "The name of the Cloudwatch Logs Log Group created for this environments web server access logs. You can specify this by setting the value for the environment variable: WebRequestCWLogGroup. Please note: if you update this value, then you will need to go and clear out the old cloudwatch logs group and delete it through Cloudwatch Logs."
Value: { "Ref" : "AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0WebRequestLogGroup"}
Resources :
AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0WebRequestLogGroup: ## Must have prefix: AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0
Type: "AWS::Logs::LogGroup"
DependsOn: AWSEBBeanstalkMetadata
DeletionPolicy: Retain ## this is required
Properties:
LogGroupName:
"Fn::GetOptionSetting":
Namespace: "aws:elasticbeanstalk:application:environment"
OptionName: ApplicationLogGroup
DefaultValue: {"Fn::Join":["-", [{ "Ref":"AWSEBEnvironmentName" }, "webrequests"]]}
RetentionInDays: 14
Die Cloudwatch-Log-Gruppe erstellt, aber keine Protokolle vor. Welche Schritte fehlen mir oder was ist in meiner Konfigurationsdatei falsch?
Sie wissen, Sie passieren, wenn es eine Abhilfe ist dafür? – Ian
Ich habe seit dem festgestellt, dass dies falsch ist, der awslogs-Agent, der die Protokolldateiereignisse an CloudWatch schiebt, verwendet die Datei mit der aktuellsten zuletzt bearbeiteten Zeit, ich bearbeite die Antwort – Bacon
Meinst du, dass die Protokollierung jetzt fortgesetzt wird? eine Bereitstellung? – Ian