Dynamic stream names
AlexBa opened this issue · comments
Hello,
it is possible to create dynamic stream names with the current version?
I have for example this config here:
cloudwatch_handler:
class: Maxbanton\Cwh\Handler\CloudWatch
arguments:
- "@cloudwatch_client"
- "/cw/path/for/logs-%env%-%version%/var/log/prod.log" # groupName
- "%kernel.environment%" # streamName
- 7 # retentionDays
- 10000 # logsInBatch
- [] # tags
- INFO # logLevel
The stream name is always "prod" in my case, because it's defined like this: "%kernel.environment%". But as far as I know, it's much better to split the stream names in Cloudwatch by time or another identifier.
I'm thinking about something like this here "%kernel.environment%-@CURRENT_DATE@", which should resolve to "prod-2020-10-07".
What do you think about it?
Hi @AlexBa. You can pass whatever you want to the variable streamName, it's a good idea to add current date to it, but it depends on what environment it runs, if it's daemon worker which can be alive for a long time, then it will not update stream name till next start.
Regards.