Skip to content

Resources

guance_blacklist

Guance Cloud supports filtering data that meets the conditions by setting a blacklist.

After configuring the blacklist, the data that meets the conditions will no longer be reported to the Guance Cloud workspace, helping you save data storage costs.

Example Usage

resource "guance_blacklist" "demo" {
    name = "blacklist-demo"
    type   = "logging"
    sources = ["mysql", "oracle"]
    desc = "this is a demo"

  filters = [
    {
      name      = "foo1"
      operation = "in"
      condition = "and"
      values    = ["oac-*"]
    }
  ]
}

Schema

Required

  • name (String) The name of resource.
  • type (String) The type of the resource.

Optional

  • desc (String) The description of resource.
  • filters (Attributes List) The filters of the resource. (see below for nested schema)
  • source (String) The source of the resource.
  • sources (List of String) The source list of the resource.

Read-Only

  • create_at (String) The timestamp seconds of the resource created at.
  • update_at (String) The timestamp seconds of the resource updated at.
  • uuid (String) The uuid of resource.
  • workspace_uuid (String) The uuid of the workspace.

Nested Schema for filters

Required:

  • condition (String) The condition of the filter.
  • name (String) The name of the filter.
  • operation (String) Operation, value must be one of: in, not_in, match, not_match, other value will be ignored.

Optional:

  • values (List of String) The values of the filter.

guance_membergroup

Member group is a collection of members in a workspace, and member groups can be authorized to access the resources in the workspace.

Member group is an abstract concept, it can be a team, or a department, it can help us build a reasonable organizational structure, optimize the management efficiency and user experience of the observability platform.

Relationships:

graph LR

A[Workspace] --> B[Member]
A --> C[MemberGroup]

Example Usage

variable "email" {
  type = string
}

data "guance_members" "demo" {
  search = var.email
}

resource "guance_membergroup" "demo" {
  name          = "oac-demo2"
  account_uuids = data.guance_members.demo.members[*].uuid
}

output "member" {
  value = data.guance_members.demo.members
}

Schema

Required

  • name (String) The name of resource.

Optional

  • account_uuids (List of String) Member uuid list

Read-Only

  • uuid (String) The UUID of resource.

guance_pipeline

Pipeline is a data processing language that Observability Cloud provides. Pipeline supports text parsing of different formats of log data.

By writing a pipeline script, you can customize the structure of the log and use the cut fields as attributes.

By cutting out the attribute fields, we can quickly filter the relevant logs and perform data association analysis to help us quickly locate and solve problems.

Example Usage

resource "guance_pipeline" "demo" {
  name     = "oac-demo"
  category = "logging"
  source = [
    "nginx"
  ]
  as_default           = 1
  is_force             = false
  type                 = "local"
  is_disabled          = false
  enable_by_log_backup = 1
  data_type            = "json"

  content = <<EOF
    add_pattern("date2", "%%{YEAR}[./]%%{MONTHNUM}[./]%%{MONTHDAY} %%{TIME}")

    # access log
    grok(_, "%%{NOTSPACE:client_ip} %%{NOTSPACE:http_ident} %%{NOTSPACE:http_auth} \\[%%{HTTPDATE:time}\\] \"%%{DATA:http_method} %%{GREEDYDATA:http_url} HTTP/%%{NUMBER:http_version}\" %%{INT:status_code} %%{INT:bytes}")

    # access log
    add_pattern("access_common", "%%{NOTSPACE:client_ip} %%{NOTSPACE:http_ident} %%{NOTSPACE:http_auth} \\[%%{HTTPDATE:time}\\] \"%%{DATA:http_method} %%{GREEDYDATA:http_url} HTTP/%%{NUMBER:http_version}\" %%{INT:status_code} %%{INT:bytes}")
    grok(_, '%%{access_common} "%%{NOTSPACE:referrer}" "%%{GREEDYDATA:agent}"')
    user_agent(agent)

    # error log
    grok(_, "%%{date2:time} \\[%%{LOGLEVEL:status}\\] %%{GREEDYDATA:msg}, client: %%{NOTSPACE:client_ip}, server: %%{NOTSPACE:server}, request: \"%%{DATA:http_method} %%{GREEDYDATA:http_url} HTTP/%%{NUMBER:http_version}\", (upstream: \"%%{GREEDYDATA:upstream}\", )?host: \"%%{NOTSPACE:ip_or_host}\"")
    grok(_, "%%{date2:time} \\[%%{LOGLEVEL:status}\\] %%{GREEDYDATA:msg}, client: %%{NOTSPACE:client_ip}, server: %%{NOTSPACE:server}, request: \"%%{GREEDYDATA:http_method} %%{GREEDYDATA:http_url} HTTP/%%{NUMBER:http_version}\", host: \"%%{NOTSPACE:ip_or_host}\"")
    grok(_,"%%{date2:time} \\[%%{LOGLEVEL:status}\\] %%{GREEDYDATA:msg}")

    group_in(status, ["warn", "notice"], "warning")
    group_in(status, ["error", "crit", "alert", "emerg"], "error")

    cast(status_code, "int")
    cast(bytes, "int")

    group_between(status_code, [200,299], "OK", status)
    group_between(status_code, [300,399], "notice", status)
    group_between(status_code, [400,499], "warning", status)
    group_between(status_code, [500,599], "error", status)


    nullif(http_ident, "-")
    nullif(http_auth, "-")
    nullif(upstream, "")
    default_time(time)
    EOF

  test_data = <<EOF
    127.0.0.1 - - [24/Mar/2021:13:54:19 +0800] "GET /basic_status HTTP/1.1" 200 97 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"
    EOF

  extend = {
    "app_id"        = ["test", "test1"],
    "measurement"   = ["nginx_access_log"],
    "logging_index" = "xxxx"
  }
}

Schema

Required

  • category (String) Category, value must be one of: logging, object, custom_object, network, tracing, rum, security, keyevent, metric, profiling, dialtesting, billing, keyevent, other value will be ignored.
  • content (String) Pipeline file content
  • is_force (Boolean) Is Force Overwrite. If the field as_default is true, is_force will be set to be true automatically.
  • name (String) The name of the pipeline.
  • source (List of String) Data source list
  • test_data (String) Test data
  • type (String) The type of the pipeline.Valid value: local, central

Optional

  • as_default (Number) Is Default Pipeline
  • data_type (String) The type of the data. Valid value: line_protocol, json, message.
  • enable_by_log_backup (Number) Enable pipeline processing (1=enable, 0=disable) for forwarded data.
  • extend (Attributes) (see below for nested schema)
  • is_disabled (Boolean) Is Disabled
  • is_force (Boolean) Is Force Overwrite. If the field as_default is true, is_force will be set to be true automatically.

Read-Only

  • create_at (String) The creation time of the resource, in seconds as a timestamp.
  • status (Number) The status of the pipeline. Valid value: 0, 2.
  • update_at (String) The update time of the resource, in seconds as a timestamp.
  • uuid (String) The uuid of the pipeline.
  • workspace_uuid (String) The uuid of the workspace.

Nested Schema for extend

Optional:

  • app_id (List of String)
  • logging_index (String)
  • measurement (List of String)

guance_role

Guance Cloud supports creating roles to manage the permissions of users. Role management provides users with an intuitive entry for permission management, supporting the flexible adjustment of the permission scope corresponding to different roles, creating new roles for users, and assigning permission scopes to roles to meet the permission needs of different users.

Example Usage

resource "guance_role" "role" {
  name = "tf-test-role1"
  desc = "test role"
  keys = ["snapshot.delete", "workspace.readMember"]
}

Schema

Required

  • keys (List of String) The permission keys.
  • name (String) The name of the role.

Optional

  • desc (String) The description of the role.

Read-Only

  • uuid (String) The UUID of the role.

Feedback

Is this page helpful? ×