Skip to content

Commit

Permalink
Make all log options available (#9)
Browse files Browse the repository at this point in the history
* Add all log options optionally to the elasticsearch domain.

* Update readme with new variables for elasticsearch log options.

* Change Cloudwatch to the canonical name CloudWatch.
  • Loading branch information
Claas Lisowski authored and aknysh committed Oct 4, 2018
1 parent 4eb9a7d commit 65d3c78
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ Available targets:
| instance_count | Number of data nodes in the cluster | string | `4` | no |
| instance_type | Elasticsearch instance type for data nodes in the cluster | string | `t2.small.elasticsearch` | no |
| kibana_subdomain_name | The name of the subdomain for Kibana in the DNS zone (_e.g._ `kibana`, `ui`, `ui-es`, `search-ui`, `kibana.elasticsearch`) | string | `kibana` | no |
| log_publishing_cloudwatch_log_group_arn | ARN of the Cloudwatch log group to which log needs to be published | string | `` | no |
| log_publishing_enabled | Specifies whether log publishing option is enabled or not | string | `false` | no |
| log_publishing_log_type | A type of Elasticsearch log. Valid values: INDEX_SLOW_LOGS, SEARCH_SLOW_LOGS | string | `SEARCH_SLOW_LOGS` | no |
| log_publishing_index_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log needs to be published for INDEX_SLOW_LOGS | string | `` | no |
| log_publishing_search_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log needs to be published for SEARCH_SLOW_LOGS | string | `` | no |
| log_publishing_application_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log needs to be published for ES_APPLICATION_LOGS | string | `` | no |
| log_publishing_index_enabled | Specifies whether log publishing option for index slow logs is enabled or not | string | `false` | no |
| log_publishing_search_enabled | Specifies whether log publishing option for search slow logs is enabled or not | string | `false` | no |
| log_publishing_application_enabled | Specifies whether log publishing option for application logs is enabled or not | string | `false` | no |
| name | Name of the application | string | - | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | string | - | yes |
| security_groups | List of security group IDs to be allowed to connect to the cluster | list | `<list>` | no |
Expand Down
9 changes: 6 additions & 3 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
| instance_count | Number of data nodes in the cluster | string | `4` | no |
| instance_type | Elasticsearch instance type for data nodes in the cluster | string | `t2.small.elasticsearch` | no |
| kibana_subdomain_name | The name of the subdomain for Kibana in the DNS zone (_e.g._ `kibana`, `ui`, `ui-es`, `search-ui`, `kibana.elasticsearch`) | string | `kibana` | no |
| log_publishing_cloudwatch_log_group_arn | ARN of the Cloudwatch log group to which log needs to be published | string | `` | no |
| log_publishing_enabled | Specifies whether log publishing option is enabled or not | string | `false` | no |
| log_publishing_log_type | A type of Elasticsearch log. Valid values: INDEX_SLOW_LOGS, SEARCH_SLOW_LOGS | string | `SEARCH_SLOW_LOGS` | no |
| log_publishing_index_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log needs to be published for INDEX_SLOW_LOGS | string | `` | no |
| log_publishing_search_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log needs to be published for SEARCH_SLOW_LOGS | string | `` | no |
| log_publishing_application_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log needs to be published for ES_APPLICATION_LOGS | string | `` | no |
| log_publishing_index_enabled | Specifies whether log publishing option for index slow logs is enabled or not | string | `false` | no |
| log_publishing_search_enabled | Specifies whether log publishing option for search slow logs is enabled or not | string | `false` | no |
| log_publishing_application_enabled | Specifies whether log publishing option for application logs is enabled or not | string | `false` | no |
| name | Name of the application | string | - | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | string | - | yes |
| security_groups | List of security group IDs to be allowed to connect to the cluster | list | `<list>` | no |
Expand Down
18 changes: 15 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,21 @@ resource "aws_elasticsearch_domain" "default" {
}

log_publishing_options {
enabled = "${var.log_publishing_enabled }"
log_type = "${var.log_publishing_log_type}"
cloudwatch_log_group_arn = "${var.log_publishing_cloudwatch_log_group_arn}"
enabled = "${var.log_publishing_index_enabled }"
log_type = "INDEX_SLOW_LOGS"
cloudwatch_log_group_arn = "${var.log_publishing_index_cloudwatch_log_group_arn}"
}

log_publishing_options {
enabled = "${var.log_publishing_search_enabled }"
log_type = "SEARCH_SLOW_LOGS"
cloudwatch_log_group_arn = "${var.log_publishing_search_cloudwatch_log_group_arn}"
}

log_publishing_options {
enabled = "${var.log_publishing_application_enabled }"
log_type = "ES_APPLICATION_LOGS"
cloudwatch_log_group_arn = "${var.log_publishing_application_cloudwatch_log_group_arn}"
}

tags = "${module.label.tags}"
Expand Down
32 changes: 25 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,40 @@ variable "encrypt_at_rest_kms_key_id" {
description = "The KMS key id to encrypt the Elasticsearch domain with. If not specified, then it defaults to using the AWS/Elasticsearch service KMS key"
}

variable "log_publishing_enabled" {
variable "log_publishing_index_enabled" {
type = "string"
default = "false"
description = "Specifies whether log publishing option is enabled or not"
description = "Specifies whether log publishing option for INDEX_SLOW_LOGS is enabled or not"
}

variable "log_publishing_log_type" {
variable "log_publishing_search_enabled" {
type = "string"
default = "SEARCH_SLOW_LOGS"
description = "A type of Elasticsearch log. Valid values: INDEX_SLOW_LOGS, SEARCH_SLOW_LOGS"
default = "false"
description = "Specifies whether log publishing option for SEARCH_SLOW_LOGS is enabled or not"
}

variable "log_publishing_application_enabled" {
type = "string"
default = "false"
description = "Specifies whether log publishing option for ES_APPLICATION_LOGS is enabled or not"
}

variable "log_publishing_index_cloudwatch_log_group_arn" {
type = "string"
default = ""
description = "ARN of the CloudWatch log group to which log for INDEX_SLOW_LOGS needs to be published"
}

variable "log_publishing_search_cloudwatch_log_group_arn" {
type = "string"
default = ""
description = "ARN of the CloudWatch log group to which log for SEARCH_SLOW_LOGS needs to be published"
}

variable "log_publishing_cloudwatch_log_group_arn" {
variable "log_publishing_application_cloudwatch_log_group_arn" {
type = "string"
default = ""
description = "ARN of the Cloudwatch log group to which log needs to be published"
description = "ARN of the CloudWatch log group to which log for ES_APPLICATION_LOGS needs to be published"
}

variable "automated_snapshot_start_hour" {
Expand Down

0 comments on commit 65d3c78

Please sign in to comment.