awsapplyansibleplaybookslogsummarizer

package module
v0.0.0-...-9886201 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 9 Imported by: 0

README

go-aws-apply-ansible-playbooks-log-summarizer

PkgGoDev Test Go Report Card Test Coverage Maintainability Code Climate technical debt GitHub go.mod Go version Twitter URL

AWS-ApplyAnsiblePlaybooks log summarizer for Golang.

Quickstart

go get -d github.com/yukihiko-shinoda/go-aws-apply-ansible-playbooks-log-summarizer
package main

import (
	"context"
	"log"

	"github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs"
	"github.com/aws/aws-sdk-go-v2/service/ec2"
	"github.com/aws/aws-sdk-go-v2/service/ssm"
	awsapplyansibleplaybookslogsummarizer "github.com/yukihiko-shinoda/go-aws-apply-ansible-playbooks-log-summarizer"
)

func main() {
	config, err := config.LoadDefaultConfig(context.TODO())
	if err != nil {
		log.Fatal(err)
	}

	ssmClient := ssm.NewFromConfig(config)
	ec2Client := ec2.NewFromConfig(config)
	cloudwatchlogsClient := cloudwatchlogs.NewFromConfig(config)

	err := awsapplyansibleplaybookslogsummarizer.ViewLog(ssmClient, ec2Client, cloudwatchlogsClient)
	if err != nil {
		log.Fatal(err)
	}
}

Example output:

i-0abcdefghijklmno0 EC2InstanceName10 Some error 2
i-90abcdefghijklmn0  Some error 1
i-34567890abcdefgh0     EC2InstanceName3        51700219-01-14 11:59:43 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   


i-234567890abcdefg0     EC2InstanceName2        51700219-01-14 11:58:05 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   


i-7890abcdefghijkl0     EC2InstanceName7        51700219-01-14 12:08:45 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=4    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


i-567890abcdefghij0     EC2InstanceName5        51700219-01-14 12:04:29 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=4    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


i-890abcdefghijklm0     EC2InstanceName8        51700219-01-14 12:11:15 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


i-67890abcdefghijk0     EC2InstanceName6        51700219-01-14 12:06:28 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


i-4567890abcdefghi0     EC2InstanceName4        51700219-01-14 12:01:46 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


i-1234567890abcdef0     EC2InstanceName1        51700219-01-14 11:55:50 +0000 UTC
TASK [file] *********************************************************************************************************************************************************************************************************************
PLAY RECAP **********************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ViewLog

func ViewLog(ssmClient command.ListCommandsListCommandInvocationsAPI, ec2Client instance.DescribeInstancesAPI, cloudwatchlogsClient logs.GetLogEventsAPI, commandId *string) error

Types

This section is empty.

Directories

Path Synopsis
_testlibraries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL