OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… OC(1) β€” the openshift CLI girlies' manual πŸ’…

okay so real talk, this is the oc manual page, and today we're doing the logs glow-up. It's from June 2016 bestie, so she's vintage but she still ate. Let's go ✨


🌸 NAME 🌸

oc logs β€” print the logs for a container in a pod. literally just vibes and output. 🫢

πŸŽ€ SYNOPSIS πŸŽ€

oc logs [OPTIONS]

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: you wanna print the logs for a resource. That's the whole game, no cap.

The supported resources are builds, build configs (bc), deployment configs (dc), and pods. Iconic lineup honestly.

Here's the tea though β€” when a pod is specified and it has more than one container, you gotta name that container with -c. Otherwise it's giving "which one???" 😭 And when a build config or deployment config is specified, you can peek at the logs for a particular version of it via --version. Obsessed with the precision.

If your pod is failing to start, you may need to use the --previous option to see the logs of the last attempt. She's not being dramatic, she's being accurate. πŸ’€

✨ OPTIONS ✨

  • --all-containers=false β€” get all containers' logs in the pod(s). all of them. the whole squad. πŸ‘‘
  • --all-pods=false β€” get logs from all pod(s). Oh and heads up, this sets prefix to TRUE. automatic. you're welcome. πŸ’…
  • -c, --container="" β€” print the logs of this container. name your container, bestie, don't leave her guessing.
  • -f, --follow=false β€” specify if the logs should be streamed. yes queen, keep it flowing. 🌊
  • --ignore-errors=false β€” if watching / following pod logs, allow for any errors that occur to be non-fatal. like, it's fine, we move. πŸ™ˆ
  • --insecure-skip-tls-verify-backend=false β€” skip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired. ⚠️ real warning, not a cute one β€” this one's giving risky.
  • --limit-bytes=0 β€” maximum bytes of logs to return. Defaults to no limit. free rein, no cap (literally). πŸ”₯
  • --max-log-requests=5 β€” specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5. five little streams running in parallel, slay.
  • --pod-running-timeout=0 β€” the length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running. patience is a virtue bestie ⏳
  • --prefix=false β€” prefix each log line with the log source (pod name and container name). receipts included. 🧾
  • -p, --previous=false β€” if true, print the logs for the previous instance of the container in a pod if it exists. digging up the past, respectfully.
  • -l, --selector="" β€” selector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'. (e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints. all of them. no partial credit. πŸ’―
  • --since=0 β€” 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. pick a lane, babe. πŸš—
  • --since-time="" β€” only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used. same rule, different flag. 🀝
  • --tail=-1 β€” lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10, if a selector is provided. read that twice, it's a whole conditional situation. πŸ“–
  • --timestamps=false β€” include timestamps on each line in the log output. time is real. ⏰
  • --version=0 β€” view the logs of a particular build or deployment by version if greater than zero. throwback era, but make it versioned. πŸ•°οΈ

🌈 OPTIONS INHERITED FROM PARENT COMMANDS 🌈

these came from the parent commands, we're just borrowing them, sharing is caring πŸ’œ

  • --as="" β€” username to impersonate for the operation. User could be a regular user or a service account in a namespace. main character energy, but borrowed. 🎭
  • --as-group=[] β€” group to impersonate for the operation, this flag can be repeated to specify multiple groups. stack 'em.
  • --as-uid="" β€” UID to impersonate for the operation.
  • --as-user-extra=[] β€” user extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key.
  • --cache-dir="/homeless-shelter/.kube/cache" β€” default cache directory. yes that's the actual path, we don't make the rules. 🏠
  • --certificate-authority="" β€” path to a cert file for the certificate authority.
  • --client-certificate="" β€” path to a client certificate file for TLS.
  • --client-key="" β€” path to a client key file for TLS. keep her safe πŸ”
  • --cluster="" β€” the name of the kubeconfig cluster to use.
  • --context="" β€” the name of the kubeconfig context to use.
  • --disable-compression=false β€” if true, opt-out of response compression for all requests to the server.
  • --insecure-skip-tls-verify=false β€” if true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. ⚠️ read it again. yeah. insecure insecure.
  • --kubeconfig="" β€” path to the kubeconfig file to use for CLI requests.
  • --kuberc="" β€” path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
  • --match-server-version=false β€” require server version to match client version. matchy matchy πŸͺž
  • -n, --namespace="" β€” if present, the namespace scope for this CLI request.
  • --profile="none" β€” name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex).
  • --profile-output="profile.pprof" β€” name of the file to write the profile to.
  • --request-timeout="0" β€” 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. zero = infinite patience, she will wait forever 😭
  • -s, --server="" β€” the address and port of the Kubernetes API server.
  • --tls-server-name="" β€” server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used.
  • --token="" β€” bearer token for authentication to the API server. 🀫 don't share her.
  • --user="" β€” the name of the kubeconfig user to use.
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code. strict queen. πŸ’€

πŸ“ EXAMPLE πŸ“

# Start streaming the logs of the most recent build of the openldap build config
oc logs -f bc/openldap

# Start streaming the logs of the latest deployment of the mysql deployment config
oc logs -f dc/mysql

# Get the logs of the first deployment for the mysql deployment config. Note that logs
# from older deployments may not exist either because the deployment was successful
# or due to deployment pruning or manual deletion of the deployment
oc logs --version=1 dc/mysql

# Return a snapshot of ruby-container logs from pod backend
oc logs backend -c ruby-container

# Start streaming of ruby-container logs from pod backend
oc logs -f pod/backend -c ruby-container

^^ that's the whole tutorial bestie, copy paste and thrive 🫢✨


🧚 SEE ALSO 🧚

oc(1), β€” that's the one and only reference, go say hi to the main page πŸ’–


πŸ‘‘ HISTORY πŸ‘‘

June 2016, Ported from the Kubernetes man-doc generator β€” she's a port, she's a legend, she's been here since 2016 and she's still serving. πŸ’…


okay that's the whole page! and for the cute sign-off: this masterpiece came from Openshift β€” Openshift CLI User Manuals β€” dated June 2016, and honestly? still iconic. bye bestie, go stream some logs πŸŒˆπŸ’–πŸŽ€
πŸ“¦ where this page comes from