github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/cli/kbcli_cluster_logs.md (about) 1 --- 2 title: kbcli cluster logs 3 --- 4 5 Access cluster log file. 6 7 ``` 8 kbcli cluster logs NAME [flags] 9 ``` 10 11 ### Examples 12 13 ``` 14 # Return snapshot logs from cluster mycluster with default primary instance (stdout) 15 kbcli cluster logs mycluster 16 17 # Display only the most recent 20 lines from cluster mycluster with default primary instance (stdout) 18 kbcli cluster logs mycluster --tail=20 19 20 # Display stdout info of specific instance my-instance-0 (cluster name comes from annotation app.kubernetes.io/instance) 21 kbcli cluster logs --instance my-instance-0 22 23 # Return snapshot logs from cluster mycluster with specific instance my-instance-0 (stdout) 24 kbcli cluster logs mycluster --instance my-instance-0 25 26 # Return snapshot logs from cluster mycluster with specific instance my-instance-0 and specific container 27 # my-container (stdout) 28 kbcli cluster logs mycluster --instance my-instance-0 -c my-container 29 30 # Return slow logs from cluster mycluster with default primary instance 31 kbcli cluster logs mycluster --file-type=slow 32 33 # Begin streaming the slow logs from cluster mycluster with default primary instance 34 kbcli cluster logs -f mycluster --file-type=slow 35 36 # Return the specific file logs from cluster mycluster with specific instance my-instance-0 37 kbcli cluster logs mycluster --instance my-instance-0 --file-path=/var/log/yum.log 38 39 # Return the specific file logs from cluster mycluster with specific instance my-instance-0 and specific 40 # container my-container 41 kbcli cluster logs mycluster --instance my-instance-0 -c my-container --file-path=/var/log/yum.log 42 ``` 43 44 ### Options 45 46 ``` 47 -c, --container string Container name. 48 --file-path string Log-file path. File path has a priority over file-type. When file-path and file-type are unset, output stdout/stderr of target container. 49 --file-type string Log-file type. List them with list-logs cmd. When file-path and file-type are unset, output stdout/stderr of target container. 50 -f, --follow Specify if the logs should be streamed. 51 -h, --help help for logs 52 --ignore-errors If watching / following pod logs, allow for any errors that occur to be non-fatal. Only take effect for stdout&stderr. 53 -i, --instance string Instance name. 54 --limit-bytes int Maximum bytes of logs to return. 55 --prefix Prefix each log line with the log source (pod name and container name). Only take effect for stdout&stderr. 56 -p, --previous If true, print the logs for the previous instance of the container in a pod if it exists. Only take effect for stdout&stderr. 57 --since duration Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used. Only take effect for stdout&stderr. 58 --since-time string Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used. Only take effect for stdout&stderr. 59 --tail int Lines of recent log file to display. Defaults to -1 for showing all log lines. (default -1) 60 --timestamps Include timestamps on each line in the log output. Only take effect for stdout&stderr. 61 ``` 62 63 ### Options inherited from parent commands 64 65 ``` 66 --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 67 --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. 68 --as-uid string UID to impersonate for the operation. 69 --cache-dir string Default cache directory (default "$HOME/.kube/cache") 70 --certificate-authority string Path to a cert file for the certificate authority 71 --client-certificate string Path to a client certificate file for TLS 72 --client-key string Path to a client key file for TLS 73 --cluster string The name of the kubeconfig cluster to use 74 --context string The name of the kubeconfig context to use 75 --disable-compression If true, opt-out of response compression for all requests to the server 76 --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 77 --kubeconfig string Path to the kubeconfig file to use for CLI requests. 78 --match-server-version Require server version to match client version 79 -n, --namespace string If present, the namespace scope for this CLI request 80 --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 81 -s, --server string The address and port of the Kubernetes API server 82 --tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used 83 --token string Bearer token for authentication to the API server 84 --user string The name of the kubeconfig user to use 85 ``` 86 87 ### SEE ALSO 88 89 * [kbcli cluster](kbcli_cluster.md) - Cluster command. 90 91 #### Go Back to [CLI Overview](cli.md) Homepage. 92