Skip to content

Commit

Permalink
changed log group name format
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielzolty committed Oct 26, 2023
1 parent 0366eab commit 2e9a5c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion terraform/testcases/otlp_logs/otconfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ 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;
private static final int MAX_RETRY_COUNT = 12;
private static final int QUERY_LIMIT = 100;
private JsonSchema schema;
protected String logGroupName;

private Context context;

protected final ObjectMapper mapper = new ObjectMapper();
Expand All @@ -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);
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 2e9a5c1

Please sign in to comment.