Search code examples
loggingaws-lambdaprometheusteamcityamazon-cloudwatch

How to ingest Prometheus logs from TeamCity into Cloudwatch?


TeamCity has Prometheus logs located at myServerURL/app/metrics. I want to use these metrics in CloudWatch. What are the best steps to take to do this?

I think I need to:

  • expose Prometheus metrics endpoint
  • create AWS Cloudwatch log group where I want to store these metrics

What else is involved and do I need to format the Prometheus data in a different way for CloudWatch?


Solution

  • First of all, expose Prometheus metrics endpoints:

    As per your endpoint URL myServerURL/app/metrics it is already exposed so don't need to do anything.

    Secondly, Create an IAM role that has full access to CloudWatch with the following roles policies attached so you can have access to the logs.

    • CloudWatchAgentServerPolicy
    • CloudWatchFullAccess
    • CloudWatchLogsFullAccess

    On your TeamCity Server Install the CloudWatch agent and configure the CloudWatch agent by creating a file in JSON format. Here is a reference for your configuration CloudWatch with Prometheus Configuration