# Configures a log scraping jobapiVersion:logging.gdc.goog/v1kind:LoggingTargetmetadata:# Choose a namespace that matches the namespace of the workload podsnamespace:project-1name:my-service-logging-targetspec:# Choose a matching pattern that identifies the pods for this job# Optional# Relationship between different selectors: 'AND'selector:# The clusters to collect logs from.# The default configuration is to collect logs from all clusters.# The relationship between different clusters is an 'OR' relationship.# For example, the value '["admin", "system"]' indicates to consider# the admin cluster 'OR' the system cluster.# OptionalmatchClusters:-cluster-1-cluster-2# The pod name prefixes to collect logs from.# The Observability platform scrapes all pods with names# that start with the specified prefixes.# The values must contain '[a-z0-9-]' characters only.# The relationship between different list elements is an 'OR' relationship.# OptionalmatchPodNames:-pod-1-pod-2# The container name prefixes to collect logs from.# The Observability platform scrapes all containers with names# that start with the specified prefixes.# The values must contain '[a-z0-9-]' characters only.# The relationship between different list elements is an 'OR' relationship.# OptionalmatchContainerNames:-container-1-container-2# Choose the predefined parser for log entries.# Use parsers to map the log output to labels and extract fields.# Specify the log format.# Optional# Options: klog_text, klog_json, klogr, gdch_json, jsonparser:klog_text# Specify an access level for log entries.# The default value is 'ao'.# Optional# Options: ao, pa, iologAccessLevel:ao# Specify a service name to be applied as a label# For user workloads consider this field as a workload name# RequiredserviceName:service-name# The additional static fields to apply to log entries.# The field is a key-value pair, where the field name is the key and# the field value is the value.# OptionaladditionalFields:app:workload2key:value
apiVersion:monitoring.gdc.goog/v1kind:MonitoringTargetmetadata:# Choose the same namespace as the workload podsnamespace:project-1name:stringspec:# Choose matching pattern that identifies pods for this job# Optional# Relationship between different selectors: ANDselector:# Choose clusters to consider for this job# Optional# List# Default: All clusters applicable to this project.# Relationship between different list elements: ORmatchClusters:-string# Choose pod-labels to consider for this job# Optional: Map of key-value pairs.# Default: No filtering by label.# Relationship between different pairs: ANDmatchLabels:key1:value1# Choose annotations to consider for this job# Optional: Map of key-value pairs# Default: No filtering by annotation# Relationship between different pairs: ANDmatchAnnotations:key1:value1# Configure the endpoint exposed for this jobpodMetricsEndpoints:# Choose port either via static value or annotation# Optional# Annotation takes priority# Default: static port 80port:value:integerannotation:string# Choose path either via static value or annotation# Optional# Annotation takes priority# Default: static path /metricspath:value:stringannotation:string# Choose scheme either via static value (http or https) or annotation# Optional# Annotation takes priority# Default: static scheme httpscheme:value:stringannotation:string# Choose the frequency to scrape the metrics endpoint defined in podMetricsEndpoints# Optional# Default: 60sscrapeInterval:string# Dynamically rewrite the label set of a target before it gets scraped.# https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config# Optional# Default: No filtering by labelmetricsRelabelings:-sourceLabels:-stringseparator:stringregex:stringaction:stringtargetLabel:stringreplacement:string
# Configure observability pipelineapiVersion:observability.gdc.goog/v1kind:ObservabilityPipelinemetadata:# Don't change the namespace or name.namespace:platform-obsname:observability-configspec:...monitoring:grafana:storageSize:1Gi# Configure the new storage size for dashboards in the project....
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThe Observability API utilizes Kubernetes custom resources and the Kubernetes Resource Model (KRM) for managing logging and monitoring resources.\u003c/p\u003e\n"],["\u003cp\u003eProvisioned projects automatically have several Observability services available, which users cannot create or delete directly.\u003c/p\u003e\n"],["\u003cp\u003eThe recommended method for interacting with the Observability API is through the \u003ccode\u003egdcloud\u003c/code\u003e CLI provided by GDC.\u003c/p\u003e\n"],["\u003cp\u003eThe primary API endpoint for Observability services is \u003ccode\u003ehttps://[ADMIN_CLUSTER_KUBERNETES_API_ENDPOINT]/apis/observability.gdc.goog/v1alpha1\u003c/code\u003e, with similar endpoints for monitoring and logging.\u003c/p\u003e\n"],["\u003cp\u003eYou can use \u003ccode\u003ekubectl proxy\u003c/code\u003e to access the API discovery document locally, enabling you to explore and interact with the API's structure and capabilities.\u003c/p\u003e\n"]]],[],null,["# Observability API overview\n\nThe Observability API uses Kubernetes custom resources and relies on the Kubernetes Resource Model (KRM) for provisioning and managing logging and monitoring resources.\n\nUse the Observability API to manage the lifecycle of Observability services in a given organization or custom project. The lifecycle of Observability services includes operations such as install, upgrade, and uninstall. You must deploy a custom resource to your project according to the Observability service you want to manage.\n\nMany Observability services are available automatically for a provisioned project, for example, logging, monitoring, and alerting.\n\nService endpoint\n----------------\n\nThe following URLs are the API endpoints for the Observability KRM API:\n\n- **Logging group:**\n\n https://\u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER_ENDPOINT\u003c/var\u003e/apis/logging.gdc.goog/v1\n\n- **Monitoring group:**\n\n https://\u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER_ENDPOINT\u003c/var\u003e/apis/monitoring.gdc.goog/v1\n\n- **Observability group:**\n\n https://\u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER_ENDPOINT\u003c/var\u003e/apis/observability.gdc.goog/v1\n\nReplace \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER_ENDPOINT\u003c/var\u003e with the endpoint of the Management API server.\n\nDiscovery document\n------------------\n\nUse the `kubectl proxy --port=8001` command to open a proxy to the API server on your local machine. From there, you can access the discovery document at one of the following URLs:\n\n- `http://127.0.0.1:8001/apis/logging.gdc.goog/v1`\n- `http://127.0.0.1:8001/apis/monitoring.gdc.goog/v1`\n- `http://127.0.0.1:8001/apis/observability.gdc.goog/v1`\n\nExample resources\n-----------------\n\nThis section contains example resources that use the Observability KRM API.\n\n### Logging group\n\nThe following is an example of a `LoggingTarget` custom resource to collect logs from specific services on the `project-1` project: \n\n # Configures a log scraping job\n apiVersion: logging.gdc.goog/v1\n kind: LoggingTarget\n metadata:\n # Choose a namespace that matches the namespace of the workload pods\n namespace: project-1\n name: my-service-logging-target\n spec:\n # Choose a matching pattern that identifies the pods for this job\n # Optional\n # Relationship between different selectors: 'AND'\n selector:\n # The clusters to collect logs from.\n # The default configuration is to collect logs from all clusters.\n # The relationship between different clusters is an 'OR' relationship.\n # For example, the value '[\"admin\", \"system\"]' indicates to consider\n # the admin cluster 'OR' the system cluster.\n # Optional\n matchClusters:\n - cluster-1\n - cluster-2\n\n # The pod name prefixes to collect logs from.\n # The Observability platform scrapes all pods with names\n # that start with the specified prefixes.\n # The values must contain '[a-z0-9-]' characters only.\n # The relationship between different list elements is an 'OR' relationship.\n # Optional\n matchPodNames:\n - pod-1\n - pod-2\n\n # The container name prefixes to collect logs from.\n # The Observability platform scrapes all containers with names\n # that start with the specified prefixes.\n # The values must contain '[a-z0-9-]' characters only.\n # The relationship between different list elements is an 'OR' relationship.\n # Optional\n matchContainerNames:\n - container-1\n - container-2\n\n # Choose the predefined parser for log entries.\n # Use parsers to map the log output to labels and extract fields.\n # Specify the log format.\n # Optional\n # Options: klog_text, klog_json, klogr, gdch_json, json\n parser: klog_text\n\n # Specify an access level for log entries.\n # The default value is 'ao'.\n # Optional\n # Options: ao, pa, io\n logAccessLevel: ao\n\n # Specify a service name to be applied as a label\n # For user workloads consider this field as a workload name\n # Required\n serviceName: service-name\n\n # The additional static fields to apply to log entries.\n # The field is a key-value pair, where the field name is the key and\n # the field value is the value.\n # Optional\n additionalFields:\n app: workload2\n key: value\n\n### Monitoring group\n\nThe following is an example of a `MonitoringTarget` custom resource to collect metrics from workloads on the `project-1` project: \n\n apiVersion: monitoring.gdc.goog/v1\n kind: MonitoringTarget\n metadata:\n # Choose the same namespace as the workload pods\n namespace: project-1\n name: string\n spec:\n # Choose matching pattern that identifies pods for this job\n # Optional\n # Relationship between different selectors: AND\n selector:\n # Choose clusters to consider for this job\n # Optional\n # List\n # Default: All clusters applicable to this project.\n # Relationship between different list elements: OR\n matchClusters:\n - string\n\n # Choose pod-labels to consider for this job\n # Optional: Map of key-value pairs.\n # Default: No filtering by label.\n # Relationship between different pairs: AND\n matchLabels:\n key1: value1\n\n # Choose annotations to consider for this job\n # Optional: Map of key-value pairs\n # Default: No filtering by annotation\n # Relationship between different pairs: AND\n matchAnnotations:\n key1: value1\n\n # Configure the endpoint exposed for this job\n podMetricsEndpoints:\n # Choose port either via static value or annotation\n # Optional\n # Annotation takes priority\n # Default: static port 80\n port:\n value: integer\n annotation: string\n\n # Choose path either via static value or annotation\n # Optional\n # Annotation takes priority\n # Default: static path /metrics\n path:\n value: string\n annotation: string\n\n # Choose scheme either via static value (http or https) or annotation\n # Optional\n # Annotation takes priority\n # Default: static scheme http\n scheme:\n value: string\n annotation: string\n\n # Choose the frequency to scrape the metrics endpoint defined in podMetricsEndpoints\n # Optional\n # Default: 60s\n scrapeInterval: string\n\n # Dynamically rewrite the label set of a target before it gets scraped.\n # https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config\n # Optional\n # Default: No filtering by label\n metricsRelabelings:\n - sourceLabels:\n - string\n separator: string\n regex: string\n action: string\n targetLabel: string\n replacement: string\n\n### Observability group\n\nThe following is an example of the `ObservabilityPipeline` custom resource to update the storage size for dashboards in the `platform-obs` project namespace: \n\n # Configure observability pipeline\n apiVersion: observability.gdc.goog/v1\n kind: ObservabilityPipeline\n metadata:\n # Don't change the namespace or name.\n namespace: platform-obs\n name: observability-config\n spec:\n ...\n monitoring:\n grafana:\n storageSize: 1Gi # Configure the new storage size for dashboards in the project.\n ..."]]