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
As pointed out in the docs, the
awscloudwatchlogsexporter doesn't have theaccess_key_idandsecret_access_keyfields 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.