maxbanton / cwh

Amazon Web Services CloudWatch Logs Handler for Monolog library
MIT License
417 stars 84 forks source link

[BUG] Log not getting written to CW #98

Closed sterichards closed 3 years ago

sterichards commented 3 years ago

Describe the bug I am using Symfony 5.3. The group and stream get created but $log->debug('something') / $log->warning('something else) etc do not write anything to CW. I have copy/pasted the AWS policy against the IAM user but it doesn't seem permission related because there are no errors and the group/stream get created from the code being ran

Expected behavior To see log entries in the CW stream

Please provide the steps to reproduce and if possible a minimal demo of the problem Any instructions how to reproduce a bug:

    ```

$client = new CloudWatchLogsClient(self::sdkParams);

    $groupName = 'php-logtest';

    $streamName = 'ec2-instance-1';

    $handler = new CloudWatch($client, $groupName, $streamName);

    $handler->setFormatter(new JsonFormatter());

    $log = new Logger('name');

    $log->pushHandler($handler);

    $log->debug('Foo');
    $log->warning('Bar');
    $log->error('Baz');
    $log->addRecord(1, 'test');


**Please tell about your environment:**
  - PHP Version: 8.0
  - Operating system (distro): Ubuntu
  - Application mode:
    - [ ] Web app
    - [x] CLI app
    - [ ] Daemon worker
sterichards commented 3 years ago

I've changed the group name and stream name to something different and now it works