[英]trying to call cloudwatch loggroupname and logstreamname in terratest with the help of awsgosdk
in the terratest, I want to call the aws cloud watch specific log group name and log stream name below code is from git hub but no idea how to call specific log group and log stream 在terratest,我想调用aws云监视特定的日志组名称和日志流名称下面的代码来自git hub但不知道如何调用特定的日志组和日志流
https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/go/example_code/cloudwatch/CloudWatchGetLogEvents.go https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/go/example_code/cloudwatch/CloudWatchGetLogEvents.go
Try something like this 尝试这样的事情
c := aws.NewCloudWatchLogsClient(t, awsRegion)
t.Run("logStreamExists", func(t *testing.T) {
output, err := c.DescribeLogStreams(&cloudwatchlogs.DescribeLogStreamsInput{
LogGroupName: &logGroupName,
})
if err != nil {
assert.Fail(t, "Failed to get log streams")
}
var names []string
for _, element := range output.LogStreams {
names = append(names, *element.LogStreamName)
}
assert.Contains(t, names, logStreamName)
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.