AWS EB Node.JSlogin到CloudWatch

是否有任何可能的解决scheme将在Elastic Beanstalk上运行的应用程序的Node.JS日志stream式传输到Amazon CloudWatch?

我没有看到cwl-webrequest-metrics.config文件,但是没有关于格式的信息,我无法格式化它以将Node.JS日志(仅)传送到CloudWatch。

那你提前发表你的意见!

       

网上收集的解决方案 "AWS EB Node.JSlogin到CloudWatch"

问题有点老,但对于来自Google的用户,这里有一个可用于Node.JS日志stream的.ebextensionconfiguration,

# Store Node.JS Application Logs in Cloudwatch Mappings: CWLogs: NodeJSLogGroup: LogFile: "/var/log/nodejs/nodejs.log" TimestampFormat: "%d/%b/%Y:%H:%M:%S %z" Outputs: NodeJSCWLogGroup: Description: "Node.JS Application Logs" Value: { "Ref" : "AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0NodeJSLogGroup"} Resources : AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0NodeJSLogGroup: ## 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: NodeJSCWLogGroup DefaultValue: {"Fn::Join":["-", [{ "Ref":"AWSEBEnvironmentName" }, "nodejs"]]} RetentionInDays: 14 ## Register the files/log groups for monitoring AWSEBAutoScalingGroup: Metadata: "AWS::CloudFormation::Init": CWLogsAgentConfigSetup: files: ## any .conf file put into /tmp/cwlogs/conf.d will be added to the cwlogs config (see cwl-agent.config) "/tmp/cwlogs/conf.d/nodejs.conf": content : | [nodjs-log] file = `{"Fn::FindInMap":["CWLogs", "NodeJSLogGroup", "LogFile"]}` log_group_name = `{ "Ref" : "AWSEBCloudWatchLogs8832c8d3f1a54c238a40e36f31ef55a0NodeJSLogGroup" }` log_stream_name = {instance_id} datetime_format = `{"Fn::FindInMap":["CWLogs", "NodeJSLogGroup", "TimestampFormat"]}` mode : "000400" owner : root group : root 

看起来像http://serebrov.github.io/html/2015-05-20-cloudwatch-setup.html也可能是一个很好的参考。