gcp get-logs
Get logs
Description
get gcp logs
Synopsis
gcp get-logs
[--site <site>]
[--resource_type <resource_type>]
[--resource_labels <resource_labels>]
[--log_name <log_name>]
[--severity <severity>]
[--count <count>]
[--filter <filter>]
[--start_time <start_time>]
[--end_time <end_time>]
Arguments
site
- (string)
Site where this command will be executed
Example: --site "site-1"
Default: input.site
Attributes: optional
resource_type
- (string)
Types of one or more parent resources from which to retrieve log entries
Example: --resource_type "gae_app"
Default: _None_
Attributes: optional
resource_labels
- (string)
labels for this resource
Example: --resource_labels "resource_labels-1"
Default: _None_
Attributes: optional
log_name
- (string)
log names to filter out the logs
Example: --log_name "projects/macro-context-293714/logs/GCEGuestAgent"
Default: _None_
Attributes: optional, multiple allowed
severity
- (string)
Severity of the logs
Example: --severity "INFO"
Default: _None_
Attributes: optional, multiple allowed
Validation:
allowed values: DEFAULT, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
count
- (int)
The maximum number of results to return from this request
Example: --count 100
Default: _None_
Attributes: optional
filter
- (string)
A filter that chooses which log entries to return
Example: --filter "resource.type=gae_app AND severity>=ERROR"
Default: _None_
Attributes: optional
start_time
- (time)
The time stamp indicating the earliest data to be returned
Example: --start_time "60m ago"
Default: 60m ago
Attributes: optional
end_time
- (time)
The time stamp indicating the latest data to be returned
Example: --end_time "now"
Default: now
Attributes: optional
Examples
Input:
Output:{
"entries": [
{
"logName": "projects/macro-context-293714/logs/stdout",
"resource": {
"type": "k8s_container",
"labels": {
"cluster_name": "cluster-2",
"container_name": "cassandra",
"location": "us-central1-c",
"namespace_name": "cass-operator",
"pod_name": "cluster1-dc1-default-sts-0",
"project_id": "macro-context-293714"
}
},
"textPayload": "INFO [nioEventLoopGroup-2-2] 2022-10-14 18:33:07,313 Cli.java:617 - address=/10.44.2.1:41262 url=/api/v0/probes/readiness status=200 OK",
"timestamp": "2022-10-14T18:33:07.313548359Z",
"receiveTimestamp": "2022-10-14T18:33:10.224351324Z",
"severity": "INFO",
"insertId": "0opzd7uiep1lo5ao",
"labels": {
"compute.googleapis.com/resource_name": "gke-cluster-2-default-pool-58fe26d9-qil9",
"k8s-pod/app_kubernetes_io/managed-by": "cass-operator",
"k8s-pod/cassandra_datastax_com/cluster": "cluster1",
"k8s-pod/cassandra_datastax_com/datacenter": "dc1",
"k8s-pod/cassandra_datastax_com/node-state": "Started",
"k8s-pod/cassandra_datastax_com/rack": "default",
"k8s-pod/cassandra_datastax_com/seed-node": "true",
"k8s-pod/controller-revision-hash": "cluster1-dc1-default-sts-59c94c67cc",
"k8s-pod/statefulset_kubernetes_io/pod-name": "cluster1-dc1-default-sts-0"
}
}
]
}
Access Control
To use this command, you need access to the following:
Field | Value |
---|---|
Action | "read" |
Service Type | "gcp" |
Service Instance | |
Namespace | |
Object Type | "logs" |
Object ID |
Please see Access Control for details.