Skip to content

Latest commit

 

History

History
2066 lines (1495 loc) · 66.7 KB

File metadata and controls

2066 lines (1495 loc) · 66.7 KB
page_title subcategory description
coralogix_alert Resource - terraform-provider-coralogix
Coralogix Alert. For more info please review - https://coralogix.com/docs/getting-started-with-coralogix-alerts/.

coralogix_alert (Resource)

Coralogix Alert. For more info please review - https://coralogix.com/docs/getting-started-with-coralogix-alerts/.

Example Usage

terraform {
  required_providers {
    coralogix = {
      version = "~> 2.0"
      source  = "coralogix/coralogix"
    }
  }
}

provider "coralogix" {
  #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>"
  #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>"
}

resource "coralogix_alert" "test" {
  name        = "logs_immediate alert"
  description = "Example of logs_immediate alert from terraform"
  priority    = "P2"

  labels = {
    alert_type        = "security"
    security_severity = "high"
  }

  incidents_settings = {
    notify_on = "Triggered and Resolved"
    retriggering_period = {
      minutes = 10
    }
  }

  schedule = {
    active_on = {
      days_of_week = ["Wednesday", "Thursday"]
      start_time = "08:30"
      end_time = "20:30"
    }
  }
  type_definition = {
    logs_immediate = {
      logs_filter = {
        simple_filter = {
          lucene_query = "message:\"error\""
        }
      }
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "logs_anomaly alert example"
  description = "Example of logs_anomaly alert from terraform"
  priority    = "P4"

  labels = {
    alert_type        = "security"
    security_severity = "high"
  }

  notification_group = {
    webhooks_settings = [{
      retriggering_period = {
        minutes = 1
      }
      notify_on  = "Triggered and Resolved"
      recipients = ["[email protected]"]
    }]
  }

  incidents_settings = {
    notify_on           = "Triggered and Resolved"
    retriggering_period = {
      minutes = 1
    }
  }

  schedule = {
    active_on = {
      days_of_week = ["Wednesday", "Thursday"]
      start_time = "08:30"
      end_time = "20:30"
    }
  }

  type_definition = {
    logs_anomaly = {
      rules = [{
        condition = {
          minimum_threshold   = 2
          time_window = "10_MINUTES"
        }
        override = {
          priority = "P2"
        }
      }]
      logs_filter = {
        simple_filter = {
          lucene_query  = "message:\"error\""
          label_filters = {
            application_name = [{
              operation = "IS"
              value     = "nginx"
            }]
            subsystem_name = [{
              operation = "IS"
              value     = "subsystem-name"
            }]
            severities = ["Warning"]
          }
        }
      }
      notification_payload_filter = [
        "coralogix.metadata.sdkId", "coralogix.metadata.sdkName", "coralogix.metadata.sdkVersion"
      ]
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "logs_threshold alert example"
  description = "Example of logs_threshold alert example from terraform"
  priority    = "P2"

  labels = {
    alert_type        = "security"
    security_severity = "high"
  }

  notification_group = {
    webhooks_settings = [{
      recipients = ["[email protected]", "[email protected]"]
    }]
  }

  incidents_settings = {
    notify_on           = "Triggered and Resolved"
    retriggering_period = {
        minutes = 1
    }
  }

  schedule = {
    active_on = {
        days_of_week = ["Wednesday", "Thursday"]
        start_time = "10:30"
        end_time = "20:30"
    }
  }

  type_definition = {
    logs_threshold = {
      rules = [{
        condition = {
          threshold   = 2
          time_window = "10_MINUTES"
          condition_type   = "LESS_THAN"
        }
        override = {
          priority = "P2"
        }
      }]
      logs_filter       = {
        simple_filter = {
          lucene_query  = "message:\"error\""
          label_filters = {
            application_name = [{
              operation = "NOT"
              value     = "application_name"
            }]
            subsystem_name = [{
              operation = "STARTS_WITH"
              value     = "subsystem-name"
            }]
            severities = ["Warning", "Error"]
          }
        }
      }
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "logs_ratio_threshold alert example"
  description = "Example of logs_ratio_threshold alert from terraform"
  priority    = "P3"

  group_by        = ["coralogix.metadata.alert_id", "coralogix.metadata.alert_name"]
  type_definition = {
    logs_ratio_threshold = {
      numerator_alias   = "numerator"
      denominator_alias = "denominator"
      rules = [{
          condition = {
              threshold         = 2
              time_window       = "10_MINUTES"
              condition_type		 = "LESS_THAN"
          }
          override = {
              priority = "P2"
          }
      }]
      group_by_for = "Denominator Only"
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "logs_new_value alert example"
  description = "Example of logs_new_value alert from terraform"
  priority    = "P2"

  type_definition = {
    logs_new_value = {
      notification_payload_filter = ["coralogix.metadata.sdkId", "coralogix.metadata.sdkName", "coralogix.metadata.sdkVersion"]
      rules = [{
        condition = {
            time_window = "24_HOURS"
            keypath_to_track = "remote_addr_geoip.country_name"
        }
        override = {
            priority = "P2"
        }
      }]
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "logs_unique_count alert example"
  description = "Example of logs_unique_count alert from terraform"
  priority    = "P2"

  group_by        = ["remote_addr_geoip.city_name"]
  type_definition = {
    logs_unique_count = {
        unique_count_keypath = "remote_addr_geoip.country_name"
        max_unique_count_per_group_by_key = 500
          rules = [ {
            condition = {
                max_unique_count     = 2
                time_window          = "5_MINUTES"
            }
        }]
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "logs_time_relative_threshold alert example"
  description = "Example of logs_time_relative_threshold alert from terraform"
  priority    = "P3"

  type_definition = {
    logs_time_relative_threshold = {
        rules = [{
            condition = {
                threshold                   = 50
                compared_to                 = "Same Day Last Week"
                ignore_infinity             = false
                condition_type                   = "LESS_THAN"
            }
            override = {
                priority = "P2"
            }
        }]
        undetected_values_management = {
            trigger_undetected_values = true
            auto_retire_timeframe     = "6_HOURS"
          }
    }
  }
}

resource "coralogix_alert" "test" { 
  name        = "metric_anomaly alert example" 
  description = "Example of metric_anomaly alert from terraform" 
  priority    = "P1" 
  type_definition = { 
      metric_anomaly = { 
          metric_filter = { 
              promql = "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)" 
          } 
          rules = [{ 
              condition = { 
                  threshold = 2 
                  for_over_pct = 10 
                  of_the_last = "10_MINUTES" 
                  condition_type = "LESS_THAN" 
                  min_non_null_values_pct = 50 
              } 
          }] 
      } 
  }
}

resource "coralogix_alert" "test" {
  name        = "metric_threshold alert example"
  description = "Example of metric_threshold alert from terraform"
  priority    = "P3"

  type_definition = {
    metric_threshold = {
        metric_filter = {
            promql = "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"
        }
        rules = [{
            condition = {
                threshold    = 2
                for_over_pct = 10
                of_the_last = "10_MINUTES"
                condition_type = "MORE_THAN_OR_EQUALS"
            }
            override = {
                priority = "P2"
            }
        }]
        missing_values = {
            replace_with_zero = true
        }
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "tracing_immediate alert example"
  description = "Example of tracing_immediate alert from terraform"
  priority    = "P1"

  type_definition = {
    tracing_immediate = {
      tracing_filter = {
        latency_threshold_ms  = 100
        tracing_label_filters = {
          application_name = [
            {
              operation = "IS"
              values    = ["nginx", "apache"]
            },
            {
                operation = "STARTS_WITH"
                values    = ["application-name:"]
            }
          ]
          subsystem_name = [
            {
              values    = ["subsystem-name"]
            }
          ]
          operation_name        = [
            {
              values    = ["operation-name"]
            }
          ]
          span_fields = [
            {
              key         = "status"
              filter_type = {
                values    = ["200"]
              }
            },
            {
              key         = "status"
              filter_type = {
                operation = "STARTS_WITH"
                values    = ["40", "50"]
              }
            },
          ]
        }
      }
    }
  }
}

resource "coralogix_alert" "test" {
  name        = "tracing_threshold alert example"
  description = "Example of tracing_threshold alert from terraform"
  priority    = "P2"

  type_definition = {
    tracing_threshold = {
        tracing_filter = {
            latency_threshold_ms  = 100
            tracing_label_filters = {
                application_name = [
                    {
                        operation = "IS"
                        values    = ["nginx", "apache"]
                    },
                    {
                        operation = "STARTS_WITH"
                        values    = ["application-name:"]
                    }
                ]
            }
        }
        rules = [{
            condition = {
                time_window = "10_MINUTES"
                span_amount = 5
            }
        }]
    }
  }
}



resource "coralogix_alert" "test_1"{
    name        = "logs immediate alert 1"
    priority    = "P1"
    type_definition = {
        logs_immediate = { 
        }
    }
}

resource "coralogix_alert" "test_2"{
    name        = "logs immediate alert 2"
    priority    = "P2"
    type_definition = {
        logs_immediate = {
        }
    }
}

resource "coralogix_alert" "test_3"{
    name        = "logs immediate alert 3"
    priority    = "P3"
    type_definition = {
        logs_immediate = {
        }
    }
}

resource "coralogix_alert" "test_4"{
    name        = "logs immediate alert 4"
    priority    = "P4"
    type_definition = {
        logs_immediate = {
        }
    }
}

resource "coralogix_alert" "test" {
    name        = "flow alert example"
    description = "Example of flow alert from terraform"
    priority    = "P3"
    type_definition = {
        flow = {
            enforce_suppression = false
            stages = [{
                flow_stages_groups = [{
                    alert_defs = [
                        {
                            id = coralogix_alert.test_1.id
                        },
                        {
                            id = coralogix_alert.test_2.id
                        },
                    ]
                    next_op   = "AND"
                    alerts_op = "OR"
                },
                {
                    alert_defs = [
                        {
                            id = coralogix_alert.test_3.id
                        },
                        {
                            id = coralogix_alert.test_4.id
                        },
                    ]
                    next_op   = "OR"
                    alerts_op = "AND"
                },]
                timeframe_ms   = 10
                timeframe_type = "Up To"
            }]
        }
    }
}

Schema

Required

  • name (String) Alert name.
  • priority (String) Alert priority. Valid values: ["P1" "P2" "P3" "P4" "P5"].
  • type_definition (Attributes) Alert type definition. Exactly one of the following must be specified: logs_immediate, logs_threshold, logs_anomaly, logs_ratio_threshold, logs_new_value, logs_unique_count, logs_time_relative_threshold, metric_threshold, metric_anomaly, tracing_immediate, tracing_threshold flow. (see below for nested schema)

Optional

  • description (String) Alert description.
  • enabled (Boolean) Alert enabled status. True by default.
  • group_by (List of String) Group by fields.
  • incidents_settings (Attributes) (see below for nested schema)
  • labels (Map of String)
  • notification_group (Attributes) (see below for nested schema)
  • phantom_mode (Boolean)
  • schedule (Attributes) Alert schedule. Will be activated all the time if not specified. (see below for nested schema)

Read-Only

  • deleted (Boolean)
  • id (String) Alert ID.

Nested Schema for type_definition

Optional:

Nested Schema for type_definition.flow

Required:

Optional:

  • enforce_suppression (Boolean)

Nested Schema for type_definition.flow.stages

Required:

Optional:

  • timeframe_ms (Number)

Nested Schema for type_definition.flow.stages.flow_stages_groups

Required:

  • alert_defs (Attributes Set) (see below for nested schema)
  • alerts_op (String) Alerts operation. Valid values: ["AND" "OR"].
  • next_op (String) Next operation. Valid values: ["AND" "OR"].

Nested Schema for type_definition.flow.stages.flow_stages_groups.alert_defs

Required:

  • id (String)

Optional:

  • not (Boolean)

Nested Schema for type_definition.logs_anomaly

Required:

Optional:

Nested Schema for type_definition.logs_anomaly.rules

Required:

Nested Schema for type_definition.logs_anomaly.rules.condition

Required:

  • minimum_threshold (Number)
  • time_window (String)

Read-Only:

  • condition_type (String)

Nested Schema for type_definition.logs_anomaly.logs_filter

Optional:

Nested Schema for type_definition.logs_anomaly.logs_filter.simple_filter

Optional:

Nested Schema for type_definition.logs_anomaly.logs_filter.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_immediate

Optional:

Nested Schema for type_definition.logs_immediate.logs_filter

Optional:

Nested Schema for type_definition.logs_immediate.logs_filter.simple_filter

Optional:

Nested Schema for type_definition.logs_immediate.logs_filter.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_immediate.logs_filter.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_immediate.logs_filter.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_new_value

Required:

Optional:

Nested Schema for type_definition.logs_new_value.rules

Required:

Nested Schema for type_definition.logs_new_value.rules.condition

Required:

  • keypath_to_track (String)
  • time_window (String)

Nested Schema for type_definition.logs_new_value.logs_filter

Optional:

Nested Schema for type_definition.logs_new_value.logs_filter.simple_filter

Optional:

Nested Schema for type_definition.logs_new_value.logs_filter.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_new_value.logs_filter.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_new_value.logs_filter.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_ratio_threshold

Required:

Optional:

  • denominator (Attributes) (see below for nested schema)
  • group_by_for (String) Group by for. Valid values: ["Both" "Denominator Only" "Numerator Only"]. 'Both' by default.
  • notification_payload_filter (Set of String)
  • numerator (Attributes) (see below for nested schema)

Nested Schema for type_definition.logs_ratio_threshold.rules

Required:

Nested Schema for type_definition.logs_ratio_threshold.rules.condition

Required:

  • condition_type (String) Condition to evaluate the threshold with. Valid values: ["LESS_THAN" "MORE_THAN"].
  • threshold (Number)
  • time_window (String)

Nested Schema for type_definition.logs_ratio_threshold.rules.override

Optional:

  • priority (String) Alert priority. Valid values: ["P1" "P2" "P3" "P4" "P5"].

Nested Schema for type_definition.logs_ratio_threshold.denominator

Optional:

Nested Schema for type_definition.logs_ratio_threshold.denominator.simple_filter

Optional:

Nested Schema for type_definition.logs_ratio_threshold.denominator.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_ratio_threshold.denominator.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_ratio_threshold.denominator.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_ratio_threshold.numerator

Optional:

Nested Schema for type_definition.logs_ratio_threshold.numerator.simple_filter

Optional:

Nested Schema for type_definition.logs_ratio_threshold.numerator.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_ratio_threshold.numerator.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_ratio_threshold.numerator.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_threshold

Required:

Optional:

Nested Schema for type_definition.logs_threshold.rules

Required:

Nested Schema for type_definition.logs_threshold.rules.condition

Required:

  • condition_type (String) Condition to evaluate the threshold with. Valid values: ["LESS_THAN" "MORE_THAN"].
  • threshold (Number)
  • time_window (String)

Nested Schema for type_definition.logs_threshold.rules.override

Optional:

  • priority (String) Alert priority. Valid values: ["P1" "P2" "P3" "P4" "P5"].

Nested Schema for type_definition.logs_threshold.logs_filter

Optional:

Nested Schema for type_definition.logs_threshold.logs_filter.simple_filter

Optional:

Nested Schema for type_definition.logs_threshold.logs_filter.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_threshold.logs_filter.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_threshold.logs_filter.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_threshold.undetected_values_management

Optional:

  • auto_retire_timeframe (String) Auto retire timeframe. Valid values: ["10_MINUTES" "12_HOURS" "1_HOUR" "24_HOURS" "2_HOURS" "5_MINUTES" "6_HOURS" "NEVER"].
  • trigger_undetected_values (Boolean)

Nested Schema for type_definition.logs_time_relative_threshold

Required:

Optional:

Nested Schema for type_definition.logs_time_relative_threshold.rules

Required:

Nested Schema for type_definition.logs_time_relative_threshold.rules.condition

Required:

  • compared_to (String) Compared to a different time frame. Valid values: ["Previous Hour" "Same Day Last Month" "Same Day Last Week" "Same Hour Last Week" "Same Hour Yesterday" "Yesterday"].
  • condition_type (String) Condition . Valid values: ["LESS_THAN" "MORE_THAN"].
  • threshold (Number)

Nested Schema for type_definition.logs_time_relative_threshold.rules.override

Optional:

  • priority (String) Alert priority. Valid values: ["P1" "P2" "P3" "P4" "P5"].

Nested Schema for type_definition.logs_time_relative_threshold.logs_filter

Optional:

Nested Schema for type_definition.logs_time_relative_threshold.logs_filter.simple_filter

Optional:

Nested Schema for type_definition.logs_time_relative_threshold.logs_filter.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_time_relative_threshold.logs_filter.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_time_relative_threshold.logs_filter.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_time_relative_threshold.undetected_values_management

Optional:

  • auto_retire_timeframe (String) Auto retire timeframe. Valid values: ["10_MINUTES" "12_HOURS" "1_HOUR" "24_HOURS" "2_HOURS" "5_MINUTES" "6_HOURS" "NEVER"].
  • trigger_undetected_values (Boolean)

Nested Schema for type_definition.logs_unique_count

Required:

Optional:

  • logs_filter (Attributes) (see below for nested schema)
  • max_unique_count_per_group_by_key (Number)
  • notification_payload_filter (Set of String)

Nested Schema for type_definition.logs_unique_count.rules

Required:

Nested Schema for type_definition.logs_unique_count.rules.condition

Required:

  • max_unique_count (Number)
  • time_window (String)

Nested Schema for type_definition.logs_unique_count.logs_filter

Optional:

Nested Schema for type_definition.logs_unique_count.logs_filter.simple_filter

Optional:

Nested Schema for type_definition.logs_unique_count.logs_filter.simple_filter.label_filters

Optional:

  • application_name (Attributes Set) (see below for nested schema)
  • severities (Set of String) Severities. Valid values: ["Critical" "Debug" "Error" "Info" "Unspecified" "Warning"].
  • subsystem_name (Attributes Set) (see below for nested schema)

Nested Schema for type_definition.logs_unique_count.logs_filter.simple_filter.label_filters.application_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.logs_unique_count.logs_filter.simple_filter.label_filters.subsystem_name

Required:

  • value (String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "IS" "NOT" "STARTS_WITH"].'IS' by default.

Nested Schema for type_definition.metric_anomaly

Required:

Nested Schema for type_definition.metric_anomaly.metric_filter

Required:

  • promql (String)

Nested Schema for type_definition.metric_anomaly.rules

Required:

Nested Schema for type_definition.metric_anomaly.rules.condition

Required:

  • condition_type (String) Condition to evaluate the threshold with. Valid values: ["LESS_THAN" "MORE_THAN"].
  • for_over_pct (Number)
  • min_non_null_values_pct (Number)
  • of_the_last (String) Time window to evaluate the threshold with. Valid values: ["10_MINUTES" "12_HOURS" "15_MINUTES" "1_HOUR" "1_MINUTE" "20_MINUTES" "24_HOURS" "2_HOURS" "30_MINUTES" "36_HOURS" "4_HOURS" "5_MINUTES" "6_HOURS"].
  • threshold (Number)

Nested Schema for type_definition.metric_threshold

Required:

Optional:

Nested Schema for type_definition.metric_threshold.metric_filter

Required:

  • promql (String)

Nested Schema for type_definition.metric_threshold.missing_values

Optional:

  • min_non_null_values_pct (Number)
  • replace_with_zero (Boolean)

Nested Schema for type_definition.metric_threshold.rules

Required:

Nested Schema for type_definition.metric_threshold.rules.condition

Required:

  • condition_type (String) Condition to evaluate the threshold with. Valid values: ["LESS_THAN" "LESS_THAN_OR_EQUALS" "MORE_THAN" "MORE_THAN_OR_EQUALS"].
  • for_over_pct (Number)
  • of_the_last (String) Time window to evaluate the threshold with. Valid values: ["10_MINUTES" "12_HOURS" "15_MINUTES" "1_HOUR" "1_MINUTE" "20_MINUTES" "24_HOURS" "2_HOURS" "30_MINUTES" "36_HOURS" "4_HOURS" "5_MINUTES" "6_HOURS"].
  • threshold (Number)

Nested Schema for type_definition.metric_threshold.rules.override

Optional:

  • priority (String) Alert priority. Valid values: ["P1" "P2" "P3" "P4" "P5"].

Nested Schema for type_definition.metric_threshold.undetected_values_management

Optional:

  • auto_retire_timeframe (String) Auto retire timeframe. Valid values: ["10_MINUTES" "12_HOURS" "1_HOUR" "24_HOURS" "2_HOURS" "5_MINUTES" "6_HOURS" "NEVER"].
  • trigger_undetected_values (Boolean)

Nested Schema for type_definition.tracing_immediate

Required:

Optional:

  • notification_payload_filter (Set of String)

Nested Schema for type_definition.tracing_immediate.tracing_filter

Required:

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters

Optional:

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters.application_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters.operation_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters.service_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters.span_fields

Required:

  • key (String)

Optional:

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters.span_fields.filter_type

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_immediate.tracing_filter.tracing_label_filters.subsystem_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_threshold

Required:

Optional:

  • notification_payload_filter (Set of String)

Nested Schema for type_definition.tracing_threshold.rules

Required:

Nested Schema for type_definition.tracing_threshold.rules.condition

Required:

  • span_amount (Number)
  • time_window (String)

Read-Only:

  • condition_type (String)

Nested Schema for type_definition.tracing_threshold.tracing_filter

Required:

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters

Optional:

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters.application_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters.operation_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters.service_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters.span_fields

Required:

  • key (String)

Optional:

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters.span_fields.filter_type

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for type_definition.tracing_threshold.tracing_filter.tracing_label_filters.subsystem_name

Required:

  • values (Set of String)

Optional:

  • operation (String) Operation. Valid values: ["ENDS_WITH" "INCLUDES" "IS" "IS_NOT" "STARTS_WITH"]. 'IS' by default.

Nested Schema for incidents_settings

Required:

  • notify_on (String) Notify on. Valid values: ["Triggered Only" "Triggered and Resolved"].
  • retriggering_period (Attributes) (see below for nested schema)

Nested Schema for incidents_settings.retriggering_period

Required:

  • minutes (Number)

Nested Schema for notification_group

Optional:

Nested Schema for notification_group.webhooks_settings

Optional:

  • integration_id (String)
  • notify_on (String) Notify on. Valid values: ["Triggered Only" "Triggered and Resolved"]. Triggered Only by default.
  • recipients (Set of String)
  • retriggering_period (Attributes) Retriggering period in minutes. 10 minutes by default. (see below for nested schema)

Nested Schema for notification_group.webhooks_settings.retriggering_period

Required:

  • minutes (Number)

Nested Schema for schedule

Required:

Nested Schema for schedule.active_on

Required:

  • days_of_week (Set of String) Days of the week. Valid values: ["Friday" "Monday" "Saturday" "Sunday" "Thursday" "Tuesday" "Wednesday"].
  • end_time (String)
  • start_time (String)

Optional:

  • utc_offset (String)

Import

Import is supported using the following syntax:

# Create an import file like this

tee -a import.tf <<EOF
terraform {
  required_providers {
    coralogix = {
      version = "~> 2.0"
      source  = "coralogix/coralogix"
    }
  }
}

provider "coralogix" {
  #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>"
  #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>"
}
#
#import {
#  to = coralogix_alert.logs_immediate_alert
#  id = "19e27a6d-470d-47e9-9447-d1a1bb512eb6"
#}
#
#import {
#  to = coralogix_alert.flow_alert_example
#  id = "41544404-db3c-4d6e-b039-b8cc3efd51f8"
#}
#
#import {
#  to = coralogix_alert.logs_new_value
#  id = "4c760ad4-2eb4-444b-9285-8a86f3eda7cb"
#}
#
#import {
#  to = coralogix_alert.tracing_more_than
#  id = "b8529327-87e2-4140-89df-3541d3171f1a"
#}
#
#import {
#  to = coralogix_alert.logs-ratio-more-than
#  id = "187f3ea4-caa7-46e1-82c0-2dfd1e67a680"
#}
EOF

## Follow the Migration Guide to obtain the following:


# __generated__ by Terraform
# Please review these resources and move them into your main configuration files.

# __generated__ by Terraform from "4c760ad4-2eb4-444b-9285-8a86f3eda7cb"
#resource "coralogix_alert" "logs_new_value" {
#  deleted     = false
#  description = "Example of logs-new-value alert from terraform"
#  enabled     = true
#  group_by    = null
#  incidents_settings = {
#    notify_on = "Triggered Only"
#    retriggering_period = {
#      minutes = 10
#    }
#  }
#  labels = null
#  name   = "logs-new-value alert example"
#  notification_group = {
#    group_by_keys     = null
#    webhooks_settings = null
#  }
#  phantom_mode = false
#  priority     = "P2"
#  schedule     = null
#  type_definition = {
#    flow           = null
#    logs_anomaly   = null
#    logs_immediate = null
#    logs_new_value = {
#      logs_filter = {
#        simple_filter = {
#          label_filters = {
#            application_name = null
#            severities       = null
#            subsystem_name   = null
#          }
#          lucene_query = null
#        }
#      }
#      notification_payload_filter = ["coralogix.metadata.sdkId", "coralogix.metadata.sdkName", "coralogix.metadata.sdkVersion"]
#      rules = [
#        {
#          condition = {
#            keypath_to_track = "remote_addr_geoip.country_name"
#            time_window = {
#              specific_value = "12_HOURS"
#            }
#          }
#        },
#      ]
#    }
#    logs_ratio_threshold         = null
#    logs_threshold               = null
#    logs_time_relative_threshold = null
#    logs_unique_count            = null
#    metric_anomaly               = null
#    metric_threshold             = null
#    tracing_immediate            = null
#    tracing_threshold            = null
#  }
#}
#
## __generated__ by Terraform from "41544404-db3c-4d6e-b039-b8cc3efd51f8"
#resource "coralogix_alert" "flow_alert_example" {
#  deleted     = false
#  description = "Example of flow alert from terraform"
#  enabled     = true
#  group_by    = null
#  incidents_settings = {
#    notify_on = "Triggered Only"
#    retriggering_period = {
#      minutes = 10
#    }
#  }
#  labels = null
#  name   = "flow alert example"
#  notification_group = {
#    group_by_keys     = null
#    webhooks_settings = null
#  }
#  phantom_mode = false
#  priority     = "P3"
#  schedule     = null
#  type_definition = {
#    flow = {
#      enforce_suppression = false
#      stages = [
#        {
#          flow_stages_groups = [
#            {
#              alert_defs = [
#                {
#                  id  = "5c197c44-a51d-4c70-a90a-77a4a21ae3d8"
#                  not = false
#                },
#                {
#                  id  = "f8a782a1-a503-4987-884f-7dac4b834b03"
#                  not = false
#                },
#              ]
#              alerts_op = "OR"
#              next_op   = "AND"
#            },
#            {
#              alert_defs = [
#                {
#                  id  = "81bba4f8-332c-4bc4-b5d2-bd074a4f969e"
#                  not = false
#                },
#                {
#                  id  = "f8a782a1-a503-4987-884f-7dac4b834b03"
#                  not = false
#                },
#              ]
#              alerts_op = "AND"
#              next_op   = "OR"
#            },
#          ]
#          timeframe_ms   = 10
#          timeframe_type = "Up To"
#        },
#      ]
#    }
#    logs_anomaly                 = null
#    logs_immediate               = null
#    logs_new_value               = null
#    logs_ratio_threshold         = null
#    logs_threshold               = null
#    logs_time_relative_threshold = null
#    logs_unique_count            = null
#    metric_anomaly               = null
#    metric_threshold             = null
#    tracing_immediate            = null
#    tracing_threshold            = null
#  }
#}
#
## __generated__ by Terraform from "19e27a6d-470d-47e9-9447-d1a1bb512eb6"
#resource "coralogix_alert" "logs_immediate_alert" {
#  deleted     = false
#  description = "Example of logs immediate alert from terraform"
#  enabled     = true
#  group_by    = null
#  incidents_settings = {
#    notify_on = "Triggered and Resolved"
#    retriggering_period = {
#      minutes = 10
#    }
#  }
#  labels = {
#    alert_type        = "security"
#    security_severity = "high"
#  }
#  name = "logs immediate alert"
#  notification_group = {
#    group_by_keys     = null
#    webhooks_settings = null
#  }
#  phantom_mode = false
#  priority     = "P2"
#  schedule = {
#    active_on = {
#      days_of_week = ["Wednesday", "Thursday"]
#      end_time = {
#        hours   = 20
#        minutes = 30
#      }
#      start_time = {
#        hours   = 8
#        minutes = 30
#      }
#    }
#  }
#  type_definition = {
#    flow         = null
#    logs_anomaly = null
#    logs_immediate = {
#      logs_filter = {
#        simple_filter = {
#          label_filters = {
#            application_name = null
#            severities       = null
#            subsystem_name   = null
#          }
#          lucene_query = "message:\"error\""
#        }
#      }
#      notification_payload_filter = null
#    }
#    logs_new_value               = null
#    logs_ratio_threshold         = null
#    logs_threshold               = null
#    logs_time_relative_threshold = null
#    logs_unique_count            = null
#    metric_anomaly               = null
#    metric_threshold             = null
#    tracing_immediate            = null
#    tracing_threshold            = null
#  }
#}
#
## __generated__ by Terraform from "187f3ea4-caa7-46e1-82c0-2dfd1e67a680"
#resource "coralogix_alert" "logs-ratio-more-than" {
#  deleted     = false
#  description = "Example of logs-ratio-more-than alert from terraform"
#  enabled     = true
#  group_by    = ["coralogix.metadata.alert_id", "coralogix.metadata.alert_name"]
#  incidents_settings = {
#    notify_on = "Triggered Only"
#    retriggering_period = {
#      minutes = 10
#    }
#  }
#  labels = null
#  name   = "logs-ratio-more-than alert example"
#  notification_group = {
#    group_by_keys     = ["coralogix.metadata.alert_id", "coralogix.metadata.alert_name"]
#    webhooks_settings = null
#  }
#  phantom_mode = false
#  priority     = "P1"
#  schedule     = null
#  type_definition = {
#    flow           = null
#    logs_anomaly   = null
#    logs_immediate = null
#    logs_new_value = null
#    logs_ratio_threshold = {
#      denominator = {
#        simple_filter = {
#          label_filters = {
#            application_name = [
#              {
#                operation = "IS"
#                value     = "nginx"
#              },
#            ]
#            severities = ["Warning"]
#            subsystem_name = [
#              {
#                operation = "IS"
#                value     = "subsystem-name"
#              },
#            ]
#          }
#          lucene_query = "mod_date:[20020101 TO 20030101]"
#        }
#      }
#      denominator_alias           = "denominator"
#      group_by_for                = "Both"
#      notification_payload_filter = null
#      numerator = {
#        simple_filter = {
#          label_filters = {
#            application_name = [
#              {
#                operation = "IS"
#                value     = "nginx"
#              },
#            ]
#            severities = ["Error"]
#            subsystem_name = [
#              {
#                operation = "IS"
#                value     = "subsystem-name"
#              },
#            ]
#          }
#          lucene_query = "mod_date:[20030101 TO 20040101]"
#        }
#      }
#      numerator_alias = "numerator"
#      rules = [
#        {
#          condition = {
#            condition_type = "MORE_THAN"
#            threshold      = 2
#            time_window = {
#              specific_value = "10_MINUTES"
#            }
#          }
#          override = {
#            priority = "P2"
#          }
#        },
#      ]
#    }
#    logs_threshold               = null
#    logs_time_relative_threshold = null
#    logs_unique_count            = null
#    metric_anomaly               = null
#    metric_threshold             = null
#    tracing_immediate            = null
#    tracing_threshold            = null
#  }
#}
#
## __generated__ by Terraform
#resource "coralogix_alert" "tracing_more_than" {
#  deleted     = false
#  description = "Example of tracing_more_than alert from terraform"
#  enabled     = true
#  group_by    = null
#  incidents_settings = {
#    notify_on = "Triggered Only"
#    retriggering_period = {
#      minutes = 10
#    }
#  }
#  labels = null
#  name   = "tracing_more_than alert example"
#  notification_group = {
#    group_by_keys     = null
#    webhooks_settings = null
#  }
#  phantom_mode = false
#  priority     = "P2"
#  schedule     = null
#  type_definition = {
#    flow                         = null
#    logs_anomaly                 = null
#    logs_immediate               = null
#    logs_new_value               = null
#    logs_ratio_threshold         = null
#    logs_threshold               = null
#    logs_time_relative_threshold = null
#    logs_unique_count            = null
#    metric_anomaly               = null
#    metric_threshold             = null
#    tracing_immediate            = null
#    tracing_threshold = {
#      notification_payload_filter = null
#      rules = [
#        {
#          condition = {
#            span_amount = 5
#            time_window = {
#              specific_value = "10_MINUTES"
#            }
#          }
#        },
#      ]
#      tracing_filter = {
#        latency_threshold_ms = 100
#        tracing_label_filters = {
#          application_name = [
#            {
#              operation = "IS"
#              values    = ["apache", "nginx"]
#            },
#            {
#              operation = "STARTS_WITH"
#              values    = ["application-name:"]
#            },
#          ]
#          operation_name = null
#          service_name   = null
#          span_fields    = null
#          subsystem_name = null
#        }
#      }
#    }
#  }
#}
#