Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in AWS by (5.6k points)

How can add custom logs to CloudWatch?

I have the default logs like this:

/aws/elasticbeanstalk/InstanceName/var/log/eb-activity.log

And I already added a file, 

files:

  "/opt/elasticbeanstalk/tasks/bundlelogs.d/applogs.conf" :

    mode: "000755"

    owner: root

    group: root

    content: |

      /var/app/current/logs/*

  "/opt/elasticbeanstalk/tasks/taillogs.d/cloud-init.conf" :

    mode: "000755"

    owner: root

    group: root

    content: |

      /var/app/current/logs/*

1 Answer

0 votes
by (12.4k points)

To extend the log you need to add another configuration under "/etc/awslogs/config/"

Providing the sample file below can take reference from,

files:

  "/etc/awslogs/config/my_app_log.conf" :

    mode: "000600"

    owner: root

    group: root

    content: |

      [/var/app/current/logs/xxx.log]

      log_group_name = `{"Fn::Join":["/", ["/aws/elasticbeanstalk", { "Ref":"AWSEBEnvironmentName" }, "var/app/current/logs/xxx.log"]]}`

      log_stream_name = {instance_id}

      file = /var/app/current/logs/xxx.log*

 You can read more on the elastic beanstalk.

 Want to learn more about AWS? Come & join: AWS Course

Related questions

0 votes
1 answer
asked Apr 2, 2020 in AWS by Amenda (1.4k points)

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
asked Nov 10, 2020 in AWS by Amyra (12.9k points)
0 votes
1 answer
asked Nov 10, 2020 in AWS by Amyra (12.9k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers

500 comments

108k users

Browse Categories

...