shinesolutions / ruby_aem_aws

Ruby client for Shine Solutions Adobe Experience Manager (AEM) Platform on AWS
Apache License 2.0
3 stars 8 forks source link

Check logstream also for hostname #25

Closed mbloch1986 closed 4 years ago

mbloch1986 commented 5 years ago

The awslogs service is using the python library cwlogs(https://pypi.org/project/awscli-cwlogs) in order to push the awslogs to AWS.

For determining the instance id the cwlogs library is using the EC2 Meta http://169.254.169.254/latest/meta-data/instance-id. If it fails to determine the instance id it automatically falls back to the hostname

code snippet from cwlogs/push.py:

    556             if not instance_id:
    557                 instance_id = (socket.gethostname() or
    558                                socket.gethostbyname(socket.gethostname()))
    559                 logger.warning('Unable to get instance id, use %s instead.',
    560                                instance_id)

We should update our code to also check if the logstrem exists for the hostname if the logstream can't be found with the instance id.

https://github.com/shinesolutions/ruby_aem_aws/blob/master/lib/ruby_aem_aws/mixins/metric_verifier.rb#L79-L81

mbloch1986 commented 4 years ago

This issue was caused by a bug in the awslogs daemon which is now fixed.