From 37ab5fded99c4fb1e3cedfcbdccd532719b303c4 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Thu, 19 Oct 2023 12:57:34 -0400 Subject: [PATCH 01/14] Adds log lines --- translator/context/context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/translator/context/context.go b/translator/context/context.go index f4b88a4f4b..c242c6665e 100644 --- a/translator/context/context.go +++ b/translator/context/context.go @@ -112,12 +112,16 @@ func (ctx *Context) SetMode(mode string) { switch mode { case config.ModeEC2: ctx.mode = config.ModeEC2 + log.Printf("Mode EC2") case config.ModeOnPrem: ctx.mode = config.ModeOnPrem + log.Printf("Mode OnPrem") case config.ModeOnPremise: ctx.mode = config.ModeOnPremise + log.Printf("Mode OnPremise") case config.ModeWithIRSA: ctx.mode = config.ModeWithIRSA + log.Printf("Mode IRSA") default: log.Panicf("Invalid mode %s. Valid mode values are %s, %s, %s and %s.", mode, config.ModeEC2, config.ModeOnPrem, config.ModeOnPremise, config.ModeWithIRSA) } From d313b092394ea1b76d652ccbb50e106135b65dc4 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 09:33:45 -0400 Subject: [PATCH 02/14] Adds log statements --- cfg/aws/credentials.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cfg/aws/credentials.go b/cfg/aws/credentials.go index 34ab40f54a..8d26d0ad15 100644 --- a/cfg/aws/credentials.go +++ b/cfg/aws/credentials.go @@ -143,13 +143,16 @@ func (c *CredentialConfig) assumeCredentials() client.ConfigProvider { Logger: SDKLogger{}, } config.Credentials = newStsCredentials(rootCredentials, c.RoleARN, c.Region) + log.Printf("the roleARN is" + c.RoleARN) return getSession(config) } func (c *CredentialConfig) Credentials() client.ConfigProvider { if c.RoleARN != "" { + log.Printf("I'm assuming credentials!") return c.assumeCredentials() } else { + log.Printf("I'm getting root credentials!") return c.rootCredentials() } } From cb812947ead66100f1fe5793ee339b7c79bcc115 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 09:56:27 -0400 Subject: [PATCH 03/14] more log statements --- plugins/outputs/cloudwatch/cloudwatch.go | 1 + plugins/processors/ec2tagger/ec2tagger.go | 1 + translator/translate/otel/exporter/awscloudwatch/translator.go | 1 + 3 files changed, 3 insertions(+) diff --git a/plugins/outputs/cloudwatch/cloudwatch.go b/plugins/outputs/cloudwatch/cloudwatch.go index f4d14cdb74..cce83f2530 100644 --- a/plugins/outputs/cloudwatch/cloudwatch.go +++ b/plugins/outputs/cloudwatch/cloudwatch.go @@ -98,6 +98,7 @@ func (c *CloudWatch) Start(_ context.Context, host component.Host) error { } configProvider := credentialConfig.Credentials() logger := models.NewLogger("outputs", "cloudwatch", "") + logger.Info("cloudwatch.go: The roleARN is " + credentialConfig.RoleARN) logThrottleRetryer := retryer.NewLogThrottleRetryer(logger) svc := cloudwatch.New( configProvider, diff --git a/plugins/processors/ec2tagger/ec2tagger.go b/plugins/processors/ec2tagger/ec2tagger.go index 5d49ce5cf7..945674e8bb 100644 --- a/plugins/processors/ec2tagger/ec2tagger.go +++ b/plugins/processors/ec2tagger/ec2tagger.go @@ -326,6 +326,7 @@ func (t *Tagger) Start(ctx context.Context, host component.Host) error { Token: t.Token, Region: t.ec2MetadataRespond.region, } + t.logger.Info("ec2tagger: the roleARN is" + t.RoleARN) t.ec2API = t.ec2Provider(ec2CredentialConfig) go func() { //Async start of initial retrieval to prevent block of agent start t.initialRetrievalOfTagsAndVolumes() diff --git a/translator/translate/otel/exporter/awscloudwatch/translator.go b/translator/translate/otel/exporter/awscloudwatch/translator.go index da497d0a37..69bca0fe6e 100644 --- a/translator/translate/otel/exporter/awscloudwatch/translator.go +++ b/translator/translate/otel/exporter/awscloudwatch/translator.go @@ -56,6 +56,7 @@ func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { credentials := confmap.NewFromStringMap(agent.Global_Config.Credentials) _ = credentials.Unmarshal(cfg) cfg.RoleARN = getRoleARN(conf) + cfg.Region = agent.Global_Config.Region if namespace, ok := common.GetString(conf, common.ConfigKey(common.MetricsKey, namespaceKey)); ok { cfg.Namespace = namespace From fa19b5301d9c612439ce5e23f8a7dc862d7dd674 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 10:30:10 -0400 Subject: [PATCH 04/14] translates roleARN in emf translator --- plugins/outputs/cloudwatchlogs/cloudwatchlogs.go | 1 + plugins/processors/ec2tagger/ec2tagger.go | 1 + translator/translate/otel/exporter/awsemf/translator.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go b/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go index 0cf6c93242..73b907d03b 100644 --- a/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go +++ b/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go @@ -133,6 +133,7 @@ func (c *CloudWatchLogs) getDest(t Target) *cwDest { Logger: configaws.SDKLogger{}, }, ) + c.Log.Info("cloudwatchLogs: roleARN is:" + c.RoleARN) agentInfo := agentinfo.New(t.Group) client.Handlers.Build.PushBackNamed(handlers.NewRequestCompressionHandler([]string{"PutLogEvents"})) client.Handlers.Build.PushBackNamed(handlers.NewCustomHeaderHandler("User-Agent", agentInfo.UserAgent())) diff --git a/plugins/processors/ec2tagger/ec2tagger.go b/plugins/processors/ec2tagger/ec2tagger.go index 945674e8bb..72cfa003c4 100644 --- a/plugins/processors/ec2tagger/ec2tagger.go +++ b/plugins/processors/ec2tagger/ec2tagger.go @@ -77,6 +77,7 @@ func newTagger(config *Config, logger *zap.Logger) *Tagger { }) }, } + p.logger.Info("ec2tagger: roleARN is" + config.RoleARN) return p } diff --git a/translator/translate/otel/exporter/awsemf/translator.go b/translator/translate/otel/exporter/awsemf/translator.go index b33881ed70..d202de23c0 100644 --- a/translator/translate/otel/exporter/awsemf/translator.go +++ b/translator/translate/otel/exporter/awsemf/translator.go @@ -93,6 +93,10 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) { if credentialsFileKey, ok := agent.Global_Config.Credentials[agent.CredentialsFile_Key]; ok { cfg.AWSSessionSettings.SharedCredentialsFile = []string{fmt.Sprintf("%v", credentialsFileKey)} } + cfg.AWSSessionSettings.RoleARN = agent.Global_Config.Role_arn + //if roleARN, ok := agent.Global_Config.Role_arn[agent.Role_Arn_Key]; ok { + // + //} cfg.AWSSessionSettings.IMDSRetries = retryer.GetDefaultRetryNumber() if isEcs(c) { From 72a3b189dabc085c5a1b119df4e1981dfaf7afbc Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 11:19:31 -0400 Subject: [PATCH 05/14] reverts logging and build commits --- cfg/aws/credentials.go | 3 --- plugins/outputs/cloudwatch/cloudwatch.go | 1 - plugins/processors/ec2tagger/ec2tagger.go | 1 - translator/context/context.go | 4 ---- .../translate/otel/exporter/awscloudwatch/translator.go | 1 - 5 files changed, 10 deletions(-) diff --git a/cfg/aws/credentials.go b/cfg/aws/credentials.go index 8d26d0ad15..34ab40f54a 100644 --- a/cfg/aws/credentials.go +++ b/cfg/aws/credentials.go @@ -143,16 +143,13 @@ func (c *CredentialConfig) assumeCredentials() client.ConfigProvider { Logger: SDKLogger{}, } config.Credentials = newStsCredentials(rootCredentials, c.RoleARN, c.Region) - log.Printf("the roleARN is" + c.RoleARN) return getSession(config) } func (c *CredentialConfig) Credentials() client.ConfigProvider { if c.RoleARN != "" { - log.Printf("I'm assuming credentials!") return c.assumeCredentials() } else { - log.Printf("I'm getting root credentials!") return c.rootCredentials() } } diff --git a/plugins/outputs/cloudwatch/cloudwatch.go b/plugins/outputs/cloudwatch/cloudwatch.go index cce83f2530..f4d14cdb74 100644 --- a/plugins/outputs/cloudwatch/cloudwatch.go +++ b/plugins/outputs/cloudwatch/cloudwatch.go @@ -98,7 +98,6 @@ func (c *CloudWatch) Start(_ context.Context, host component.Host) error { } configProvider := credentialConfig.Credentials() logger := models.NewLogger("outputs", "cloudwatch", "") - logger.Info("cloudwatch.go: The roleARN is " + credentialConfig.RoleARN) logThrottleRetryer := retryer.NewLogThrottleRetryer(logger) svc := cloudwatch.New( configProvider, diff --git a/plugins/processors/ec2tagger/ec2tagger.go b/plugins/processors/ec2tagger/ec2tagger.go index 72cfa003c4..c01202a063 100644 --- a/plugins/processors/ec2tagger/ec2tagger.go +++ b/plugins/processors/ec2tagger/ec2tagger.go @@ -327,7 +327,6 @@ func (t *Tagger) Start(ctx context.Context, host component.Host) error { Token: t.Token, Region: t.ec2MetadataRespond.region, } - t.logger.Info("ec2tagger: the roleARN is" + t.RoleARN) t.ec2API = t.ec2Provider(ec2CredentialConfig) go func() { //Async start of initial retrieval to prevent block of agent start t.initialRetrievalOfTagsAndVolumes() diff --git a/translator/context/context.go b/translator/context/context.go index c242c6665e..f4b88a4f4b 100644 --- a/translator/context/context.go +++ b/translator/context/context.go @@ -112,16 +112,12 @@ func (ctx *Context) SetMode(mode string) { switch mode { case config.ModeEC2: ctx.mode = config.ModeEC2 - log.Printf("Mode EC2") case config.ModeOnPrem: ctx.mode = config.ModeOnPrem - log.Printf("Mode OnPrem") case config.ModeOnPremise: ctx.mode = config.ModeOnPremise - log.Printf("Mode OnPremise") case config.ModeWithIRSA: ctx.mode = config.ModeWithIRSA - log.Printf("Mode IRSA") default: log.Panicf("Invalid mode %s. Valid mode values are %s, %s, %s and %s.", mode, config.ModeEC2, config.ModeOnPrem, config.ModeOnPremise, config.ModeWithIRSA) } diff --git a/translator/translate/otel/exporter/awscloudwatch/translator.go b/translator/translate/otel/exporter/awscloudwatch/translator.go index 69bca0fe6e..da497d0a37 100644 --- a/translator/translate/otel/exporter/awscloudwatch/translator.go +++ b/translator/translate/otel/exporter/awscloudwatch/translator.go @@ -56,7 +56,6 @@ func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { credentials := confmap.NewFromStringMap(agent.Global_Config.Credentials) _ = credentials.Unmarshal(cfg) cfg.RoleARN = getRoleARN(conf) - cfg.Region = agent.Global_Config.Region if namespace, ok := common.GetString(conf, common.ConfigKey(common.MetricsKey, namespaceKey)); ok { cfg.Namespace = namespace From a11db617e1839e9a4b30e87c57fe42c13cf226fd Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 11:21:43 -0400 Subject: [PATCH 06/14] removes logging and commented code --- plugins/outputs/cloudwatchlogs/cloudwatchlogs.go | 1 - plugins/processors/ec2tagger/ec2tagger.go | 1 - translator/translate/otel/exporter/awsemf/translator.go | 3 --- 3 files changed, 5 deletions(-) diff --git a/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go b/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go index 73b907d03b..0cf6c93242 100644 --- a/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go +++ b/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go @@ -133,7 +133,6 @@ func (c *CloudWatchLogs) getDest(t Target) *cwDest { Logger: configaws.SDKLogger{}, }, ) - c.Log.Info("cloudwatchLogs: roleARN is:" + c.RoleARN) agentInfo := agentinfo.New(t.Group) client.Handlers.Build.PushBackNamed(handlers.NewRequestCompressionHandler([]string{"PutLogEvents"})) client.Handlers.Build.PushBackNamed(handlers.NewCustomHeaderHandler("User-Agent", agentInfo.UserAgent())) diff --git a/plugins/processors/ec2tagger/ec2tagger.go b/plugins/processors/ec2tagger/ec2tagger.go index c01202a063..5d49ce5cf7 100644 --- a/plugins/processors/ec2tagger/ec2tagger.go +++ b/plugins/processors/ec2tagger/ec2tagger.go @@ -77,7 +77,6 @@ func newTagger(config *Config, logger *zap.Logger) *Tagger { }) }, } - p.logger.Info("ec2tagger: roleARN is" + config.RoleARN) return p } diff --git a/translator/translate/otel/exporter/awsemf/translator.go b/translator/translate/otel/exporter/awsemf/translator.go index d202de23c0..b985438525 100644 --- a/translator/translate/otel/exporter/awsemf/translator.go +++ b/translator/translate/otel/exporter/awsemf/translator.go @@ -94,9 +94,6 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) { cfg.AWSSessionSettings.SharedCredentialsFile = []string{fmt.Sprintf("%v", credentialsFileKey)} } cfg.AWSSessionSettings.RoleARN = agent.Global_Config.Role_arn - //if roleARN, ok := agent.Global_Config.Role_arn[agent.Role_Arn_Key]; ok { - // - //} cfg.AWSSessionSettings.IMDSRetries = retryer.GetDefaultRetryNumber() if isEcs(c) { From 2817b02f74c03a962310cea996c336d6bc520474 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 12:12:01 -0400 Subject: [PATCH 07/14] Adds unit test for role_arn and region being passed --- .../otel/exporter/awsemf/translator_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index fb76195e0c..2bb80b85ae 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -4,6 +4,7 @@ package awsemf import ( + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" "testing" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter" @@ -19,12 +20,15 @@ var nilMetricDescriptorsSlice []awsemfexporter.MetricDescriptor func TestTranslator(t *testing.T) { tt := NewTranslator() + agent.Global_Config.Region = "us-east-1" + agent.Global_Config.Role_arn = "global_arn" require.EqualValues(t, "awsemf", tt.ID().String()) testCases := map[string]struct { - env map[string]string - input map[string]interface{} - want map[string]interface{} // Can't construct & use awsemfexporter.Config as it uses internal only types - wantErr error + env map[string]string + input map[string]interface{} + agentConfig agent.Agent + want map[string]interface{} // Can't construct & use awsemfexporter.Config as it uses internal only types + wantErr error }{ "GenerateAwsEmfExporterConfigEcs": { input: map[string]interface{}{ @@ -675,6 +679,8 @@ func TestTranslator(t *testing.T) { require.Equal(t, testCase.want["resource_to_telemetry_conversion"], gotCfg.ResourceToTelemetrySettings) require.ElementsMatch(t, testCase.want["metric_declarations"], gotCfg.MetricDeclarations) require.ElementsMatch(t, testCase.want["metric_descriptors"], gotCfg.MetricDescriptors) + require.Equal(t, "global_arn", gotCfg.RoleARN) + require.Equal(t, "us-east-1", gotCfg.Region) } }) } From 729586e36edd1348f70893c8aa3d530766d8db3c Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 12:20:16 -0400 Subject: [PATCH 08/14] lint check --- translator/translate/otel/exporter/awsemf/translator_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index 2bb80b85ae..d10583a632 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -4,9 +4,10 @@ package awsemf import ( - "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" "testing" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" + "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry" "github.com/stretchr/testify/require" From 830ea02ba81c2edf8d182df0cad45ec1e7abfd27 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 12:24:37 -0400 Subject: [PATCH 09/14] lint fix --- translator/translate/otel/exporter/awsemf/translator_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index d10583a632..59095abc97 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" - "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry" "github.com/stretchr/testify/require" From 56cabb997a5ecc0805b0f9a688fbd932382869af Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Fri, 20 Oct 2023 12:34:43 -0400 Subject: [PATCH 10/14] regroups imports for lint --- translator/translate/otel/exporter/awsemf/translator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index 59095abc97..4edde72541 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -6,13 +6,13 @@ package awsemf import ( "testing" - "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/confmap" legacytranslator "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" ) var nilSlice []string From db73c1c38e00784a48aabd0498fa7206247d316b Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Mon, 23 Oct 2023 12:19:48 -0400 Subject: [PATCH 11/14] changes numLines for TestLogsFileAutoRemoval, to resolve mac build error --- plugins/inputs/logfile/logfile_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/logfile/logfile_test.go b/plugins/inputs/logfile/logfile_test.go index f5a38ab48c..c1354f09b7 100644 --- a/plugins/inputs/logfile/logfile_test.go +++ b/plugins/inputs/logfile/logfile_test.go @@ -434,7 +434,7 @@ func createWriteRead(t *testing.T, prefix string, logFile *LogFile, done chan bo defer close(evts) // Choose a large enough number of lines so that even high-spec hosts will not // complete receiving logEvents before the 2nd createWriteRead() goroutine begins. - const numLines int = 1000000 + const numLines int = 10000 const msg string = "this is the best log line ever written to a file" writeLines(t, file, numLines, msg) file.Close() From af50f1ddd6641a4b2f1d0cbbd8befd186ec42be8 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Mon, 23 Oct 2023 12:22:57 -0400 Subject: [PATCH 12/14] removes unused parameter --- .../translate/otel/exporter/awsemf/translator_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index 4edde72541..2418ae17fa 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -24,11 +24,10 @@ func TestTranslator(t *testing.T) { agent.Global_Config.Role_arn = "global_arn" require.EqualValues(t, "awsemf", tt.ID().String()) testCases := map[string]struct { - env map[string]string - input map[string]interface{} - agentConfig agent.Agent - want map[string]interface{} // Can't construct & use awsemfexporter.Config as it uses internal only types - wantErr error + env map[string]string + input map[string]interface{} + want map[string]interface{} // Can't construct & use awsemfexporter.Config as it uses internal only types + wantErr error }{ "GenerateAwsEmfExporterConfigEcs": { input: map[string]interface{}{ From 4228271433d881adaf500230da1496415cc84757 Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Mon, 23 Oct 2023 13:54:17 -0400 Subject: [PATCH 13/14] raises num lines to 100k --- plugins/inputs/logfile/logfile_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/logfile/logfile_test.go b/plugins/inputs/logfile/logfile_test.go index c1354f09b7..806b53ad37 100644 --- a/plugins/inputs/logfile/logfile_test.go +++ b/plugins/inputs/logfile/logfile_test.go @@ -434,7 +434,7 @@ func createWriteRead(t *testing.T, prefix string, logFile *LogFile, done chan bo defer close(evts) // Choose a large enough number of lines so that even high-spec hosts will not // complete receiving logEvents before the 2nd createWriteRead() goroutine begins. - const numLines int = 10000 + const numLines int = 100000 const msg string = "this is the best log line ever written to a file" writeLines(t, file, numLines, msg) file.Close() From 500298f8aaaa564998ef4efa709aec49a28200fc Mon Sep 17 00:00:00 2001 From: Dinakar Chappa Date: Mon, 23 Oct 2023 14:25:37 -0400 Subject: [PATCH 14/14] reverts lines back to 1M, trying by increasing timeout --- plugins/inputs/logfile/logfile_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/logfile/logfile_test.go b/plugins/inputs/logfile/logfile_test.go index 806b53ad37..2c1a2e98dd 100644 --- a/plugins/inputs/logfile/logfile_test.go +++ b/plugins/inputs/logfile/logfile_test.go @@ -434,7 +434,7 @@ func createWriteRead(t *testing.T, prefix string, logFile *LogFile, done chan bo defer close(evts) // Choose a large enough number of lines so that even high-spec hosts will not // complete receiving logEvents before the 2nd createWriteRead() goroutine begins. - const numLines int = 100000 + const numLines int = 1000000 const msg string = "this is the best log line ever written to a file" writeLines(t, file, numLines, msg) file.Close() @@ -453,7 +453,7 @@ func createWriteRead(t *testing.T, prefix string, logFile *LogFile, done chan bo select { case <-done2: t.Log("Child completed before timeout (as expected)") - case <-time.After(time.Second * 10): + case <-time.After(time.Second * 20): require.Fail(t, "timeout waiting for child") } t.Log("Verify 1st temp file was auto deleted.")