From 2e9a5c18576ddda115f925c7e517a61fb5206da4 Mon Sep 17 00:00:00 2001 From: Daniel Zolty Date: Thu, 26 Oct 2023 16:23:28 -0700 Subject: [PATCH] changed log group name format --- terraform/testcases/otlp_logs/otconfig.tpl | 2 +- .../java/com/amazon/aoc/validators/CWLogValidator.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/terraform/testcases/otlp_logs/otconfig.tpl b/terraform/testcases/otlp_logs/otconfig.tpl index 647f59101..581d8a71c 100644 --- a/terraform/testcases/otlp_logs/otconfig.tpl +++ b/terraform/testcases/otlp_logs/otconfig.tpl @@ -14,7 +14,7 @@ exporters: logging: verbosity: detailed awscloudwatchlogs: - log_group_name: "otlp-receiver" + log_group_name: "/aws/ecs/otlp/${testing_id}/logs" log_stream_name: "otlp-logs" region: ${region} diff --git a/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java b/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java index c1dffe991..74b5fb9c5 100644 --- a/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java +++ b/validator/src/main/java/com/amazon/aoc/validators/CWLogValidator.java @@ -28,6 +28,8 @@ public class CWLogValidator implements IValidator { protected String logStreamName = "otlp-logs"; + private static final String LOGGROUPPATH = "/aws/ecs/otlp/%s/logs"; + protected CloudWatchService cloudWatchService; private static final int CHECK_INTERVAL_IN_MILLI = 30 * 1000; private static final int CHECK_DURATION_IN_SECONDS = 2 * 60; @@ -35,6 +37,7 @@ public class CWLogValidator implements IValidator { private static final int QUERY_LIMIT = 100; private JsonSchema schema; protected String logGroupName; + private Context context; protected final ObjectMapper mapper = new ObjectMapper(); @@ -48,7 +51,7 @@ public void init( throws Exception { this.context = context; cloudWatchService = new CloudWatchService(context.getRegion()); - logGroupName = String.format("otlp-receiver", context.getCloudWatchContext().getClusterName()); + logGroupName = String.format(LOGGROUPPATH, context.getTestingId()); MustacheHelper mustacheHelper = new MustacheHelper(); String templateInput = mustacheHelper.render(expectedDataTemplate, context); JsonNode jsonNode = JsonLoader.fromString(templateInput); @@ -99,8 +102,6 @@ protected void validateJsonSchema(String logEventMsg) throws Exception { if (report.isSuccess()) { log.info("Report was a success"); } else { - // This will probably generate a lot of extra logs - // may want to log this to a different level in the future. log.info("[StructuredLogValidator] failed to validate schema \n"); log.info(report.toString() + "\n"); }