简体   繁体   English

在awsgosdk的帮助下尝试在terratest中调用cloudwatch loggroupname和logstreamname

[英]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.

相关问题 为AWS Lambda调用设置LogStreamName - Set LogStreamName for AWS Lambda call 尝试访问 CloudWatch 上的 Lambda 日志时出错? - Error when trying to access Lambda logs on CloudWatch? 无法调用CloudWatch:HTTP 400 - Failed to call CloudWatch: HTTP 400 尝试使用Logstash索引FROM Cloudwatch日志 - Trying to use Logstash to index FROM Cloudwatch Logs 无法在 nodejs lambda 函数中调用 cloudwatch putMetricData - Unable to call cloudwatch putMetricData in nodejs lambda function 在尝试使用golang将DropLogEvents放在cloudwatch上时获取SerializationException - Getting SerializationException while trying to PutLogEvents on cloudwatch using golang AWS:尝试将指标从 EC2 推送到 CloudWatch 时出现身份验证问题 - AWS: Authentication issues trying to push metrics to CloudWatch from EC2 尝试从 CloudWatch 获取最新的 LogStream 时出现奇怪的行为 - Strange behavior while trying to get the most recent LogStream from CloudWatch 尝试通过 terraform 设置 cloudwatch 日志过滤器时出现 InvalidParameterException - Getting InvalidParameterException while trying to setup cloudwatch log filter via terraform 通过控制台将AWS lambda日志记录到cloudWatch是,通过api调用否 - AWS lambda log to cloudWatch, via console Yes, via api call NO
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM