1

How do I configure my opentelemetry collector to export logs to Amazon awscloudwatchlogs? I have created a log-group called log-group-test-1 and under it a log-stream-test-1 Right now, I am using the current configuration for the exporter as shown below:

awscloudwatchlogs:
      region: ap-south-1
      access_key_id: <my_access_key_id> 
      secret_access_key: <my_secret_access_key>
      log_group_name: log-group-test-1
      log_stream_name: log-stream-test-1

But when I deploy the collector using helm, the collector pod goes into the CrashLoopBackOff state. And when I check the logs of the collector, this is what I get:

Error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

* error decoding 'exporters': error reading configuration for "awscloudwatchlogs": 1 error(s) decoding:

* '' has invalid keys: access_key_id, secret_access_key
2023/04/10 11:07:32 collector server run finished with error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

* error decoding 'exporters': error reading configuration for "awscloudwatchlogs": 1 error(s) decoding:

* '' has invalid keys: access_key_id, secret_access_key

Is this an AWS access key id issue or something else that I'm not considering?

I tried deleting the old access keys and creating a new one and using it, but that doesn't seem to work

Sujith Kumar
  • 872
  • 6
  • 19

1 Answers1

0

As pointed out in the docs, the awscloudwatchlogs exporter doesn't have the access_key_id and secret_access_key fields but rather gets the AWS credentials from the default credential chain. That's the reason you see this error message. Remove these two fields from the config and provide the credentials via one of the methods such as environment variables or a shared credentials file and it should work.

Michael Hausenblas
  • 13,162
  • 4
  • 52
  • 66