即使成功设置日志代理,日志也不会流式传输到云监视

时间:2019-03-05 20:41:22

标签: amazon-web-services amazon-cloudwatch vpc private-subnet

我正在尝试通过配置日志代理从私有子网中的EC2实例发送由我的应用程序创建的日志,而无需使用公共IP,并且通过系统日志从系统日志中发送,我可以看到其已成功配置,但是我看不到创建的日志流

用户数据中的命令

        #!/bin/bash
    yum update -y
    curl https://s3.amazonaws.com//aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O
    chmod +x ./awslogs-agent-setup.py
    ./awslogs-agent-setup.py -n -r us-east-1 -c ${var.s3_location}/cloudwatch-config-file
    aws s3 cp ${var.s3_location}/ocsui.zip /home/ec2-user/ocsui.zip
    unzip /home/ec2-user/ocsui.zip -d /home/ec2-user
    cd /home/ec2-user
    `sudo chmod +x /home/ec2-user/myapp`
    exec sudo -u ec2-user ENVIRONMENT=${var.environment_id} ./myapp>>myapp.log 2>&1 

EOF

EC2的摘录系统日志

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 56093  100 56093    0     0   246k      0 --:--:-- --:--:-- --:--:--  246k
Step 1 of 5: Installing pip ...[0m[92mDONE[0m
Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... [0mCompleted 212 Bytes/212 Bytes (1.1 KiB/s) with 1 file(s) remaining
download: s3://demoui-095801307151/arc/demo-ui/cloudwatch.config to var/awslogs/etc/awslogs.conf
[92mDONE[0m
Step 5 of 5: Setting up agent as a daemon ...[0m[92mDONE[0m
------------------------------------------------------[0m
- Configuration file successfully saved at: /var/awslogs/etc/awslogs.conf[0m
- You can begin accessing new log events after a few moments at https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:[0m
- You can use 'sudo service awslogs start|stop|status|restart' to control the daemon.[0m
- To see diagnostic information for the CloudWatch Logs Agent, see /var/log/awslogs.log[0m
- You can rerun interactive setup using 'sudo python ./awslogs-agent-setup.py --region us-east-1 --only-generate-config'[0m
------------------------------------------------------

请告知,TIA

0 个答案:

没有答案