Scroll to navigation

OC(1) June 2016 OC(1)

NAME

oc logs - Print the logs for a container in a pod

SYNOPSIS

oc logs [OPTIONS]

DESCRIPTION

Print the logs for a resource.

Supported resources are builds, build configs (bc), deployment configs (dc), and pods. When a pod is specified and has more than one container, the container name should be specified via -c. When a build config or deployment config is specified, you can view the logs for a particular version of it via --version.

If your pod is failing to start, you may need to use the --previous option to see the logs of the last attempt.

OPTIONS

--all-containers=false
Get all containers' logs in the pod(s).

-c, --container=""
Print the logs of this container

-f, --follow=false
Specify if the logs should be streamed.

--ignore-errors=false
If watching / following pod logs, allow for any errors that occur to be non-fatal

--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.

--limit-bytes=0
Maximum bytes of logs to return. Defaults to no limit.

--max-log-requests=5
Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.

--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

--prefix=false
Prefix each log line with the log source (pod name and container name)

-p, --previous=false
If true, print the logs for the previous instance of the container in a pod if it exists.

-l, --selector=""
Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints.

--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.

--since-time=""
Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.

--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.

--timestamps=false
Include timestamps on each line in the log output

--version=0
View the logs of a particular build or deployment by version if greater than zero

OPTIONS INHERITED FROM PARENT COMMANDS

--as=""
Username to impersonate for the operation. User could be a regular user or a service account in a namespace.

--as-group=[]
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.

--as-uid=""
UID to impersonate for the operation.

--cache-dir="/home/abuild/.kube/cache"
Default cache directory

--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

--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

--kubeconfig=""
Path to the kubeconfig file to use for CLI requests.

--match-server-version=false
Require server version to match client version

-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.

-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

--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

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

SEE ALSO

oc(1),

HISTORY

June 2016, Ported from the Kubernetes man-doc generator

Openshift CLI User Manuals Openshift