Skip to content

Commit adf3256

Browse files
authored
feat: fully remove support for Log Analysis agent. Log Analysis is a deprecated service and has been replaced by IBM Cloud Logs (#411)
BREAKING CHANGE: No longer possible to provision the Log Analysis agent
1 parent 4c4bb23 commit adf3256

File tree

11 files changed

+7
-300
lines changed

11 files changed

+7
-300
lines changed

.secrets.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-10-02T13:57:09Z",
6+
"generated_at": "2024-10-16T12:26:02Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -82,7 +82,7 @@
8282
"hashed_secret": "3f0155e75563ab3adc0505000a86da5baa207d1f",
8383
"is_secret": false,
8484
"is_verified": false,
85-
"line_number": 64,
85+
"line_number": 59,
8686
"type": "Secret Keyword",
8787
"verified_result": null
8888
}

README.md

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ This module deploys the following observability agents to an IBM Cloud Red Hat O
1010

1111
- [Logs agent](https://cloud.ibm.com/docs/cloud-logs?topic=cloud-logs-agent-about)
1212
- [Monitoring agent](https://cloud.ibm.com/docs/monitoring?topic=monitoring-about-collect-metrics)
13-
- [DEPRECATED: Log Analysis agent](https://cloud.ibm.com/docs/log-analysis?topic=log-analysis-log_analysis_agent)
14-
15-
> [!IMPORTANT]
16-
> The IBM Log Analysis service is deprecated. [IBM Cloud Logs](https://www.ibm.com/products/cloud-logs) is the replacement service and is now the default agent created with this module.
17-
1813

1914
<!-- Below content is automatically populated via pre-commit hook -->
2015
<!-- BEGIN OVERVIEW HOOK -->
@@ -84,28 +79,6 @@ module "observability_agents" {
8479
}
8580
```
8681

87-
### (DEPRECATED) Log Analysis agent configuration for Kubernetes metadata filtering
88-
89-
You can configure the logging agent to filter log lines according to the Kubernetes resources metadata by setting the exclusion and inclusion parameters.
90-
91-
For example, to set the agent to return all log lines coming from the `default` Kubernetes namespace and exclude anything with a label `app.kubernetes.io/name` with value `sample-app` or an annotation `annotation.user` with value `sample-user`, include these parameters:
92-
93-
```text
94-
custom_log_analysis_at_agent_line_exclusion = "label.app.kubernetes.io/name:sample-app\\, annotation.user:sample-user"
95-
custom_log_analysis_at_agent_line_inclusion = "namespace:default"
96-
```
97-
98-
The following is the corresponding DaemonSet configuration:
99-
100-
```text
101-
- name: LOGDNA_K8S_METADATA_LINE_INCLUSION
102-
value: "label.app.kubernetes.io/name:sample-app, annotation.user:sample-user"
103-
- name: LOGDNA_K8S_METADATA_LINE_EXCLUSION
104-
value: "namespace:default"
105-
```
106-
107-
For more information, see [Configuration for Kubernetes Metadata Filtering](https://github.com/logdna/logdna-agent-v2/blob/3.8/docs/KUBERNETES.md#configuration-for-kubernetes-metadata-filtering).
108-
10982
### Required IAM access policies
11083
You need the following permissions to run this module.
11184

@@ -136,7 +109,6 @@ You need the following permissions to run this module.
136109
| Name | Type |
137110
|------|------|
138111
| [helm_release.cloud_monitoring_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
139-
| [helm_release.log_analysis_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
140112
| [ibm_container_cluster.cluster](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_cluster) | data source |
141113
| [ibm_container_cluster_config.cluster_config](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_cluster_config) | data source |
142114
| [ibm_container_vpc_cluster.cluster](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_vpc_cluster) | data source |
@@ -162,18 +134,6 @@ You need the following permissions to run this module.
162134
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | The ID of the cluster you wish to deploy the agents in | `string` | n/a | yes |
163135
| <a name="input_cluster_resource_group_id"></a> [cluster\_resource\_group\_id](#input\_cluster\_resource\_group\_id) | The Resource Group ID of the cluster | `string` | n/a | yes |
164136
| <a name="input_is_vpc_cluster"></a> [is\_vpc\_cluster](#input\_is\_vpc\_cluster) | Specify true if the target cluster for the observability agents is a VPC cluster, false if it is a classic cluster. | `bool` | `true` | no |
165-
| <a name="input_log_analysis_add_cluster_name"></a> [log\_analysis\_add\_cluster\_name](#input\_log\_analysis\_add\_cluster\_name) | DEPRECATED: If true, configure the Log Analysis agent to attach a tag containing the cluster name to all log messages. | `bool` | `true` | no |
166-
| <a name="input_log_analysis_agent_custom_line_exclusion"></a> [log\_analysis\_agent\_custom\_line\_exclusion](#input\_log\_analysis\_agent\_custom\_line\_exclusion) | DEPRECATED: Log Analysis agent custom configuration for line exclusion setting LOGDNA\_K8S\_METADATA\_LINE\_EXCLUSION. See https://github.com/logdna/logdna-agent-v2/blob/master/docs/KUBERNETES.md#configuration-for-kubernetes-metadata-filtering for more info. | `string` | `null` | no |
167-
| <a name="input_log_analysis_agent_custom_line_inclusion"></a> [log\_analysis\_agent\_custom\_line\_inclusion](#input\_log\_analysis\_agent\_custom\_line\_inclusion) | DEPRECATED: Log Analysis agent custom configuration for line inclusion setting LOGDNA\_K8S\_METADATA\_LINE\_INCLUSION. See https://github.com/logdna/logdna-agent-v2/blob/master/docs/KUBERNETES.md#configuration-for-kubernetes-metadata-filtering for more info. | `string` | `null` | no |
168-
| <a name="input_log_analysis_agent_name"></a> [log\_analysis\_agent\_name](#input\_log\_analysis\_agent\_name) | DEPRECATED: Log Analysis agent name. Used for naming all kubernetes and helm resources on the cluster. | `string` | `"logdna-agent"` | no |
169-
| <a name="input_log_analysis_agent_namespace"></a> [log\_analysis\_agent\_namespace](#input\_log\_analysis\_agent\_namespace) | DEPRECATED: Namespace where to deploy the Log Analysis agent. Default value is 'ibm-observe' | `string` | `"ibm-observe"` | no |
170-
| <a name="input_log_analysis_agent_tags"></a> [log\_analysis\_agent\_tags](#input\_log\_analysis\_agent\_tags) | DEPRECATED: List of tags to associate to all log records that the agent collects so that you can identify the agent's data quicker in the logging UI. NOTE: Use the 'log\_analysis\_add\_cluster\_name' variable to add the cluster name as a tag. | `list(string)` | `[]` | no |
171-
| <a name="input_log_analysis_agent_tolerations"></a> [log\_analysis\_agent\_tolerations](#input\_log\_analysis\_agent\_tolerations) | DEPRECATED: List of tolerations to apply to Log Analysis agent. | <pre>list(object({<br/> key = optional(string)<br/> operator = optional(string)<br/> value = optional(string)<br/> effect = optional(string)<br/> tolerationSeconds = optional(number)<br/> }))</pre> | <pre>[<br/> {<br/> "operator": "Exists"<br/> }<br/>]</pre> | no |
172-
| <a name="input_log_analysis_enabled"></a> [log\_analysis\_enabled](#input\_log\_analysis\_enabled) | DEPRECATED: Deploy IBM Cloud Log Analysis agent | `bool` | `false` | no |
173-
| <a name="input_log_analysis_endpoint_type"></a> [log\_analysis\_endpoint\_type](#input\_log\_analysis\_endpoint\_type) | DEPRECATED: Specify the IBM Log Analysis instance endpoint type (public or private) to use. Used to construct the ingestion endpoint. | `string` | `"private"` | no |
174-
| <a name="input_log_analysis_ingestion_key"></a> [log\_analysis\_ingestion\_key](#input\_log\_analysis\_ingestion\_key) | DEPRECATED: Ingestion key for the Log Analysis agent to communicate with the instance | `string` | `null` | no |
175-
| <a name="input_log_analysis_instance_region"></a> [log\_analysis\_instance\_region](#input\_log\_analysis\_instance\_region) | DEPRECATED: The IBM Log Analysis instance region. Used to construct the ingestion endpoint. | `string` | `null` | no |
176-
| <a name="input_log_analysis_secret_name"></a> [log\_analysis\_secret\_name](#input\_log\_analysis\_secret\_name) | DEPRECATED: The name of the secret which will store the Log Analysis ingestion key. | `string` | `"logdna-agent"` | no |
177137
| <a name="input_logs_agent_additional_log_source_paths"></a> [logs\_agent\_additional\_log\_source\_paths](#input\_logs\_agent\_additional\_log\_source\_paths) | The list of additional log sources. By default, the Logs agent collects logs from a single source at `/var/log/containers/*.log`. | `list(string)` | `[]` | no |
178138
| <a name="input_logs_agent_additional_metadata"></a> [logs\_agent\_additional\_metadata](#input\_logs\_agent\_additional\_metadata) | The list of additional metadata fields to add to the routed logs. | <pre>list(object({<br/> key = optional(string)<br/> value = optional(string)<br/> }))</pre> | `[]` | no |
179139
| <a name="input_logs_agent_enable_scc"></a> [logs\_agent\_enable\_scc](#input\_logs\_agent\_enable\_scc) | Whether to enable creation of Security Context Constraints in Openshift. When installing on an OpenShift cluster, this setting is mandatory to configure permissions for pods within your cluster. | `bool` | `true` | no |

examples/obs-agent-iks/main.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,8 @@ resource "time_sleep" "wait_operators" {
128128
##############################################################################
129129

130130
module "observability_instances" {
131-
source = "terraform-ibm-modules/observability-instances/ibm"
132-
version = "2.19.1"
133-
providers = {
134-
logdna.at = logdna.at
135-
logdna.ld = logdna.ld
136-
}
131+
source = "terraform-ibm-modules/observability-instances/ibm"
132+
version = "3.0.2"
137133
resource_group_id = module.resource_group.resource_group_id
138134
region = var.region
139135
cloud_logs_plan = "standard"

examples/obs-agent-iks/provider.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,3 @@ provider "kubernetes" {
2222
token = data.ibm_container_cluster_config.cluster_config.token
2323
cluster_ca_certificate = data.ibm_container_cluster_config.cluster_config.ca_certificate
2424
}
25-
26-
locals {
27-
at_endpoint = "https://api.${var.region}.logging.cloud.ibm.com"
28-
}
29-
30-
provider "logdna" {
31-
alias = "at"
32-
servicekey = module.observability_instances.activity_tracker_resource_key != null ? module.observability_instances.activity_tracker_resource_key : ""
33-
url = local.at_endpoint
34-
}
35-
36-
provider "logdna" {
37-
alias = "ld"
38-
servicekey = module.observability_instances.log_analysis_resource_key != null ? module.observability_instances.log_analysis_resource_key : ""
39-
url = local.at_endpoint
40-
}

examples/obs-agent-iks/version.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,5 @@ terraform {
2222
source = "hashicorp/time"
2323
version = ">= 0.9.1"
2424
}
25-
# The logdna provider is not actually required by the module itself, just this example, so OK to use ">=" here instead of locking into a version
26-
logdna = {
27-
source = "logdna/logdna"
28-
version = ">= 1.14.2"
29-
}
3025
}
3126
}

examples/obs-agent-ocp/main.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,8 @@ data "ibm_container_cluster_config" "cluster_config" {
128128
##############################################################################
129129

130130
module "observability_instances" {
131-
source = "terraform-ibm-modules/observability-instances/ibm"
132-
version = "2.19.1"
133-
providers = {
134-
logdna.at = logdna.at
135-
logdna.ld = logdna.ld
136-
}
131+
source = "terraform-ibm-modules/observability-instances/ibm"
132+
version = "3.0.2"
137133
resource_group_id = module.resource_group.resource_group_id
138134
region = var.region
139135
cloud_logs_plan = "standard"

examples/obs-agent-ocp/provider.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,3 @@ provider "kubernetes" {
2222
token = data.ibm_container_cluster_config.cluster_config.token
2323
cluster_ca_certificate = data.ibm_container_cluster_config.cluster_config.ca_certificate
2424
}
25-
26-
locals {
27-
at_endpoint = "https://api.${var.region}.logging.cloud.ibm.com"
28-
}
29-
30-
provider "logdna" {
31-
alias = "at"
32-
servicekey = module.observability_instances.activity_tracker_resource_key != null ? module.observability_instances.activity_tracker_resource_key : ""
33-
url = local.at_endpoint
34-
}
35-
36-
provider "logdna" {
37-
alias = "ld"
38-
servicekey = module.observability_instances.log_analysis_resource_key != null ? module.observability_instances.log_analysis_resource_key : ""
39-
url = local.at_endpoint
40-
}

examples/obs-agent-ocp/version.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,5 @@ terraform {
1616
source = "hashicorp/kubernetes"
1717
version = ">= 2.16.1"
1818
}
19-
logdna = {
20-
source = "logdna/logdna"
21-
version = ">= 1.14.2"
22-
}
2319
}
2420
}

main.tf

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,7 @@ data "ibm_container_cluster_config" "cluster_config" {
2525

2626
locals {
2727
# LOCALS
28-
cluster_name = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].resource_name : data.ibm_container_cluster.cluster[0].resource_name # Not publically documented in provider. See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4485
29-
log_analysis_chart_location = "${path.module}/chart/logdna-agent"
30-
log_analysis_image_tag_digest = "3.10.1-20240827.12afa351b661bc07@sha256:3a7ebc7fb58de67db2af15f35ba827c96a92c06e933abb4c67431854a24bd156" # datasource: icr.io/ext/logdna-agent versioning=regex:^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)-(?<build>\d+)
31-
log_analysis_agent_registry = "icr.io/ext/logdna-agent"
32-
log_analysis_agent_tags = var.log_analysis_add_cluster_name ? concat([local.cluster_name], var.log_analysis_agent_tags) : var.log_analysis_agent_tags
33-
log_analysis_host = var.log_analysis_enabled ? var.log_analysis_endpoint_type == "private" ? "logs.private.${var.log_analysis_instance_region}.logging.cloud.ibm.com" : "logs.${var.log_analysis_instance_region}.logging.cloud.ibm.com" : null
34-
# The directory in which the logdna agent will store its state database.
35-
# Note that the agent must have write access to the directory (handlded by the initContainer) and be a persistent volume.
36-
log_analysis_agent_db_path = "/var/lib/logdna"
28+
cluster_name = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].resource_name : data.ibm_container_cluster.cluster[0].resource_name # Not publically documented in provider. See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4485
3729
cloud_monitoring_chart_location = "${path.module}/chart/sysdig-agent"
3830
cloud_monitoring_image_tag_digest = "13.4.1@sha256:469f3eee8d00ce563041770e875555dbabf02daa57cc489d9e66010707cdc621" # datasource: icr.io/ext/sysdig/agent
3931
cloud_monitoring_agent_registry = "icr.io/ext/sysdig/agent"
@@ -42,11 +34,6 @@ locals {
4234

4335
# TODO: Move this into variable.tf since module requires 1.9 now
4436
# VARIABLE VALIDATION
45-
log_analysis_key_validate_condition = var.log_analysis_enabled == true && var.log_analysis_instance_region == null && var.log_analysis_ingestion_key == null
46-
log_analysis_key_validate_msg = "Values for 'log_analysis_ingestion_key' and 'log_analysis_instance_region' variables must be passed when 'log_analysis_enabled = true'"
47-
# tflint-ignore: terraform_unused_declarations
48-
log_analysis_key_validate_check = regex("^${local.log_analysis_key_validate_msg}$", (!local.log_analysis_key_validate_condition ? local.log_analysis_key_validate_msg : ""))
49-
5037
cloud_monitoring_key_validate_condition = var.cloud_monitoring_enabled == true && var.cloud_monitoring_instance_region == null && var.cloud_monitoring_access_key == null
5138
cloud_monitoring_key_validate_msg = "Values for 'cloud_monitoring_access_key' and 'log_analysis_instance_region' variables must be passed when 'cloud_monitoring_enabled = true'"
5239
# tflint-ignore: terraform_unused_declarations
@@ -60,93 +47,6 @@ locals {
6047
validate_icl_ingress_endpoint = var.logs_agent_enabled == true && (var.cloud_logs_ingress_endpoint == null || var.cloud_logs_ingress_endpoint == "") ? tobool("When 'logs_agent_enabled' is enabled, you cannot set 'cloud_logs_ingress_endpoint' as null or empty string.") : true
6148
}
6249

63-
/** Log Analysis Configuration Start **/
64-
resource "helm_release" "log_analysis_agent" {
65-
count = var.log_analysis_enabled ? 1 : 0
66-
name = var.log_analysis_agent_name
67-
chart = local.log_analysis_chart_location
68-
namespace = var.log_analysis_agent_namespace
69-
create_namespace = true
70-
timeout = 1200
71-
wait = true
72-
recreate_pods = true
73-
force_update = true
74-
75-
set {
76-
name = "metadata.name"
77-
type = "string"
78-
value = var.log_analysis_agent_name
79-
}
80-
set {
81-
name = "image.version"
82-
type = "string"
83-
value = local.log_analysis_image_tag_digest
84-
}
85-
set {
86-
name = "image.registry"
87-
type = "string"
88-
value = local.log_analysis_agent_registry
89-
}
90-
set {
91-
name = "env.host"
92-
type = "string"
93-
value = local.log_analysis_host
94-
}
95-
set {
96-
name = "secret.name"
97-
type = "string"
98-
value = var.log_analysis_secret_name
99-
}
100-
set_sensitive {
101-
name = "secret.key"
102-
type = "string"
103-
value = var.log_analysis_ingestion_key
104-
}
105-
set {
106-
name = "agent.tags"
107-
type = "string"
108-
value = join("\\,", local.log_analysis_agent_tags)
109-
}
110-
set {
111-
name = "agent.dbPath"
112-
type = "string"
113-
value = local.log_analysis_agent_db_path
114-
}
115-
116-
values = [
117-
yamlencode({
118-
tolerations = var.log_analysis_agent_tolerations
119-
})
120-
]
121-
122-
dynamic "set" {
123-
for_each = var.log_analysis_agent_custom_line_inclusion != null ? [var.log_analysis_agent_custom_line_inclusion] : []
124-
content {
125-
name = "agentMetadataLineInclusion"
126-
type = "string"
127-
value = set.value
128-
}
129-
}
130-
131-
dynamic "set" {
132-
for_each = var.log_analysis_agent_custom_line_exclusion != null ? [var.log_analysis_agent_custom_line_exclusion] : []
133-
content {
134-
name = "agentMetadataLineExclusion"
135-
type = "string"
136-
value = set.value
137-
}
138-
}
139-
140-
provisioner "local-exec" {
141-
command = "${path.module}/scripts/confirm-rollout-status.sh ${var.log_analysis_agent_name} ${var.log_analysis_agent_namespace}"
142-
interpreter = ["/bin/bash", "-c"]
143-
environment = {
144-
KUBECONFIG = data.ibm_container_cluster_config.cluster_config.config_file_path
145-
}
146-
}
147-
}
148-
/** Log Analysis Configuration End **/
149-
15050
/** Cloud Monitoring Configuration Start **/
15151
resource "helm_release" "cloud_monitoring_agent" {
15252
count = var.cloud_monitoring_enabled ? 1 : 0

moved.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
# The following moved blocks allow consumers to upgrade without instances being destroyed
22

3-
moved {
4-
from = helm_release.logdna_agent[0]
5-
to = helm_release.log_analysis_agent[0]
6-
}
7-
83
moved {
94
from = helm_release.sysdig_agent[0]
105
to = helm_release.cloud_monitoring_agent[0]
116
}
127

13-
moved {
14-
from = data.ibm_resource_instance.logdna_instance[0]
15-
to = data.ibm_resource_instance.log_analysis_instance[0]
16-
}
17-
188
moved {
199
from = data.ibm_resource_instance.sysdig_instance[0]
2010
to = data.ibm_resource_instance.cloud_monitoring_instance[0]

0 commit comments

Comments
 (0)