姓名
kf logs
- 显示应用的日志
摘要
kf logs APP_NAME [flags]
说明
对于每个正在运行的应用实例,其日志从 Kubernetes 日志端点流式传输。
如果应用实例变化或与 Kubernetes 的连接超时,日志流可能会显示重复的日志。
当集群上的空间允许时,将保留应用实例的日志;但当空间不足或超过保留日期时将被删除。Cloud Logging 是一种更可靠的访问历史日志的机制。
如果您需要特定实例的日志,请使用 kubectl
CLI。
示例
# Follow/tail the log stream kf logs myapp # Follow/tail the log stream with 20 lines of context kf logs myapp -n 20 # Get recent logs from the App kf logs myapp --recent # Get the most recent 200 lines of logs from the App kf logs myapp --recent -n 200
标志
-h, --help
- 有关 logs 的帮助
-n, --number=int
- 显示最后 N 行日志。(默认值:10)
--recent
- 转储近期日志,而不是进行跟踪。
继承的标志
这些标志继承自父命令。
--config=string
- 配置文件(默认为 $HOME/.kf)
--kubeconfig=string
- Kubectl 配置文件(默认为 $HOME/.kube/config)
--log-http
- 将 HTTP 请求记录到 stderr
--space=string
- 用于对其运行命令的空间。这会覆盖当前目标空间