-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ship SSH and key change logs to CloudWatch
* Optional new variable for log group name * Install and configure the CloudWatch agent * Move the healthchecks to a different port so the NLB doesn't fill up the SSH logs
- Loading branch information
1 parent
11b10ed
commit f1b0967
Showing
8 changed files
with
88 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
resource "aws_ssm_parameter" "cloudwatch_agent_config" { | ||
count = var.log_group_name == null ? 0 : 1 | ||
|
||
# CloudWatchAgentServerPolicy grants permission to read parameters with the prefix "AmazonCloudWatch-" | ||
name = "AmazonCloudWatch-${var.name_prefix}-bastion" | ||
type = "String" | ||
value = jsonencode({ | ||
agent = { | ||
metrics_collection_interval = 5 | ||
}, | ||
logs = { | ||
logs_collected = { | ||
files = { | ||
collect_list = [ | ||
{ | ||
log_group_name = var.log_group_name | ||
log_stream_name = "{instance_id}-ssh" | ||
file_path = "/var/log/secure" | ||
}, | ||
{ | ||
log_group_name = var.log_group_name | ||
log_stream_name = "{instance_id}-changelog" | ||
file_path = "/var/log/bastion/changelog.log" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters