laravel-cloudwatch-logs icon indicating copy to clipboard operation
laravel-cloudwatch-logs copied to clipboard

Add config option for $createGroup

Open DBX12 opened this issue 3 years ago • 4 comments

Requested feature

Configuration option create_group

Rationale

When the underlying Maxbanton\Cwh\Handler\Cloudwatch instance flushes the logs, it will initialize itself and check if the log group and log stream already exist or create them if they do not. To prevent this behavior (for example due to limited permissions on AWS), they provide the constructor parameter createGroup which defaults to true -> to source code. It would be beneficial to have this parameter exposed as config option of this log handler so it can be configured on the application level. Currently, the parameter is left unspecified in this library -> to source code

Let me know what you think about this so I might open a pull request in the future.

DBX12 avatar Sep 08 '22 10:09 DBX12

It is understandable why administrators might be reluctant to allow the logs:DescribeLogGroups since it cannot be scoped to a single resource. An malicious actor who obtained the application's AWS credentials is able to learn the names of all log groups in the account even though actual access to them might be blocked.

DBX12 avatar Sep 08 '22 10:09 DBX12

I have a problem with this thing too, will be great to that parameter can be moved to config

stefanrakicfaxi avatar Sep 29 '22 10:09 stefanrakicfaxi

#38 seems to add this

particleflux avatar Jul 28 '23 17:07 particleflux

With #42 that was merged around 3 weeks ago has shifted from using Maxbanton\Cwh\Handler\Cloudwatch to PhpNexus\Cwh\Handler\Cloudwatch package.

The current open PR #38 might be helpful but the new package PhpNexus also supports an additional param $creatStream which is useful to further reduce API calls to AWS in case LogGroup and LogStream both already exist - reference docs

I am looking forward to having this suggestion accepted so that API throttling can be controlled by the application via config params exposed by the library.

danishn avatar Sep 21 '23 04:09 danishn