@@ -5,9 +5,22 @@ if [ -z "${STAGE}" ]
55then
66 export STAGE=dev
77fi
8- aws --region us-east-1 --profile " lfproduct-${STAGE} " logs filter-log-events --log-group-name " /aws/lambda/cla-backend-${STAGE} -api-v3-lambda" --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " | jq -r ' .events.[0].timestamp' | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
9- aws --region us-east-1 --profile " lfproduct-${STAGE} " logs filter-log-events --log-group-name " /aws/lambda/cla-backend-${STAGE} -apiv1" --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " | jq -r ' .events.[0].timestamp' | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
10- aws --region us-east-1 --profile " lfproduct-${STAGE} " logs filter-log-events --log-group-name " /aws/lambda/cla-backend-${STAGE} -apiv2" --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " | jq -r ' .events.[0].timestamp' | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
11- aws --region us-east-1 --profile " lfproduct-${STAGE} " logs filter-log-events --log-group-name " /aws/lambda/cla-backend-${STAGE} -githubactivity" --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " | jq -r ' .events.[0].timestamp' | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
12- aws --region us-east-1 --profile " lfproduct-${STAGE} " logs filter-log-events --log-group-name " /aws/lambda/cla-backend-${STAGE} -githubinstall" --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " | jq -r ' .events.[0].timestamp' | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
13- aws --region us-east-2 --profile " lfproduct-${STAGE} " logs filter-log-events --log-group-name " /aws/lambda/cla-backend-go-api-v4-lambda" --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " | jq -r ' .events.[0].timestamp' | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
8+ # Array of log group configurations: "region log_group_name"
9+ log_groups=(
10+ " us-east-1 /aws/lambda/cla-backend-${STAGE} -api-v3-lambda"
11+ " us-east-1 /aws/lambda/cla-backend-${STAGE} -apiv1"
12+ " us-east-1 /aws/lambda/cla-backend-${STAGE} -apiv2"
13+ " us-east-1 /aws/lambda/cla-backend-${STAGE} -githubactivity"
14+ " us-east-1 /aws/lambda/cla-backend-${STAGE} -githubinstall"
15+ " us-east-2 /aws/lambda/cla-backend-go-api-v4-lambda"
16+ )
17+
18+ for entry in " ${log_groups[@]} " ; do
19+ region=$( echo " $entry " | awk ' {print $1}' )
20+ log_group=$( echo " $entry " | cut -d' ' -f2-)
21+ aws --region " $region " --profile " lfproduct-${STAGE} " logs filter-log-events \
22+ --log-group-name " $log_group " \
23+ --start-time 0 --limit 1 --filter-pattern " \" LG:api-request-path\" " \
24+ | jq -r ' .events.[0].timestamp' \
25+ | awk ' {print strftime("%Y-%m-%d %H:%M:%S", $1/1000)}'
26+ done
0 commit comments