[英]Is it possible to rename an AWS CloudWatch Log Group?
I have created an AWS CloudWatch log group with a name which was not very future proof. 我创建了一个AWS CloudWatch日志组,其名称不是未来的证据。 Is it possible to rename such a log group?
是否可以重命名这样的日志组? I could find no option to do this via the CloudWatch console.
我无法通过CloudWatch控制台找到这样做的选项。
I guess an alternative would be to export the content of the log group, create a new log group with the desired name, and then re-consume the exported logs to the new log group. 我想另一种方法是导出日志组的内容,创建一个具有所需名称的新日志组,然后将导出的日志重新使用到新的日志组。 I would prefer to avoid this approach though, as (apart from being tedious) this would reset the
ingestionTime
of all the log events in the log group. 我宁愿避免这种做法虽然,因为(除了是繁琐的),这将重置
ingestionTime
日志组中的所有日志事件。
It does not seem to be possible at the current time. 目前似乎不可能。 The AWS CLI only lists the following
log-group
-related actions at this time: AWS CLI目前仅列出以下与
log-group
相关的操作:
My solution, since the log-group was only recently created and all the original log files were still on the EC2 instance, was to: 我的解决方案,因为日志组最近才创建,并且所有原始日志文件仍在EC2实例上,所以:
$ /etc/init.d/awslogs stop
. $ /etc/init.d/awslogs stop
EC2实例上的CloudWatch Logs代理。 /var/awslogs/etc/awslogs.conf
on the EC2 instance to specify the desired log group name instead of the previous one. /var/awslogs/etc/awslogs.conf
以指定所需的日志组名称而不是前一个名称。 $ /etc/init.d/awslogs start
. $ /etc/init.d/awslogs start
EC2实例上的CloudWatch Logs代理。 Quite the tedious procedure, especially with having to manually move the log files, one at a time, in the correct order. 相当繁琐的程序,尤其是必须以正确的顺序一次一个地手动移动日志文件。 Would be neat if there was functionality in the future to rename a log group.
如果将来有功能重命名日志组,那将会很整洁。
A "solution" ... 一个办法” ...
Create the new log group. 创建新的日志组。 Have the streams write to this log group.
让流写入此日志组。 Using aws cli get the events for each of the streams for the old log group and then put them to the new group.
使用aws cli获取旧日志组的每个流的事件,然后将它们放入新组。
I've got about 2,000 streams I'm about to do this too. 我也有大约2000个流我也要这样做。 We restructured are group names.
我们重组的是团体名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.