oc-logs man page

oc logs — Print the logs for a resource.

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

-c, --container=""
Print the logs of this container
-f, --follow=false
Specify if the logs should be streamed.
--include-extended-apis=true
If true, include definitions of new APIs via calls to the API server. [default true]
--interactive=false
If true, prompt the user for input when required.
--limit-bytes=0
Maximum bytes of logs to return. Defaults to no limit.
-p, --previous=false
If true, print the logs for the previous instance of the container in a pod if it exists.
--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, showing all log lines.
--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

--api-version=""
DEPRECATED: The API version to use when talking to the server

--as=""
Username to impersonate for the operation.

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

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

--context=""
The name of the kubeconfig context to use

--google-json-key=""
The Google Cloud Platform Service Account JSON Key to use for authentication.

--insecure-skip-tls-verify=false
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.

--log-flush-frequency=0
Maximum number of seconds between log flushes

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

-n, --namespace=""
If present, the namespace scope for this CLI request.

--server=""
The address and port of the Kubernetes API server

--token=""
Bearer token for authentication to the API server.

--user=""
The name of the kubeconfig user to use

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

Referenced By

oc(1).

Openshift CLI User Manuals Openshift June 2016