File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 32
32
33
33
if [[ $OSTYPE =~ ^darwin ]] ; then
34
34
cutoff_date=$( gdate --date=' -1 days' +%Y-%m-%d)
35
+ cutoff_date_milli=$( gdate --date=' -1 days' +%s%3N)
35
36
else
36
37
cutoff_date=$( date --date=' -1 days' +%Y-%m-%d)
38
+ cutoff_date_milli=$( date --date=' -1 days' +%s%3N)
37
39
fi
38
40
39
41
echo " --- Cleaning up resources older than ${cutoff_date} "
@@ -59,4 +61,11 @@ aws ec2 describe-instances \
59
61
--filters " Name=tag:Name,Values=Packer Builder" \
60
62
--query " $( printf ' Reservations[].Instances[?LaunchTime<`%s`].[InstanceId]' " $cutoff_date " ) " \
61
63
--output text \
62
- | xargs -n1 -t -I% aws ec2 terminate-instances --instance-ids " %"
64
+ | xargs -n1 -t -I% aws ec2 terminate-instances --instance-ids " %"
65
+
66
+ echo " --- Deleting old lambda logs after ${cutoff_date_milli} "
67
+ aws logs describe-log-groups \
68
+ --log-group-name-prefix " /aws/lambda/buildkite-aws-stack-test-" \
69
+ --query " $( printf ' logGroups[?creationTime<`%s`].[logGroupName]' " $cutoff_date_milli " ) " \
70
+ --output text \
71
+ | xargs -n1 -t -I% aws logs delete-log-group --log-group-name " %"
Original file line number Diff line number Diff line change @@ -1068,14 +1068,6 @@ Resources:
1068
1068
Role : !GetAtt AsgProcessSuspenderRole.Arn
1069
1069
Runtime : ' python3.7'
1070
1070
1071
- # This mirrors the group that would be created by the lambda, but enforces
1072
- # a retention period and also ensures it's removed when the stack is removed
1073
- AzRebalancingSuspenderFunctionLogGroup :
1074
- Type : AWS::Logs::LogGroup
1075
- Properties :
1076
- LogGroupName : !Sub "/aws/lambda/${AzRebalancingSuspenderFunction}"
1077
- RetentionInDays : 1
1078
-
1079
1071
AzRebalancingSuspender :
1080
1072
Type : AWS::CloudFormation::CustomResource
1081
1073
Version : 1.0
You can’t perform that action at this time.
0 commit comments