Skip to content

Commit

Permalink
Merge pull request containers#5214 from baude/apiv2loglibpod
Browse files Browse the repository at this point in the history
apiv2 libpod container logs
  • Loading branch information
openshift-merge-robot authored Feb 14, 2020
2 parents 97fdfd0 + b1034ea commit 9e9b157
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
7 changes: 0 additions & 7 deletions pkg/api/handlers/libpod/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,6 @@ func WaitContainer(w http.ResponseWriter, r *http.Request) {
utils.WriteResponse(w, http.StatusOK, strconv.Itoa(int(exitCode)))
}

func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
// follow
// since
// timestamps
// tail string
}

func UnmountContainer(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
name := utils.GetName(r)
Expand Down
57 changes: 54 additions & 3 deletions pkg/api/server/register_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
// - in: query
// name: stdout
// type: boolean
// description: not supported
// description: Return logs from stdout
// - in: query
// name: stderr
// type: boolean
// description: not supported?
// description: Return logs from stderr
// - in: query
// name: since
// type: string
Expand Down Expand Up @@ -793,7 +793,58 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/libpod/containers/{name}/unmount"), APIHandler(s.Context, libpod.UnmountContainer)).Methods(http.MethodPost)
r.HandleFunc(VersionedPath("/libpod/containers/{name}/logs"), APIHandler(s.Context, libpod.LogsFromContainer)).Methods(http.MethodGet)
// swagger:operation GET /libpod/containers/{name}/logs libpod libpodLogsFromContainer
// ---
// tags:
// - containers
// summary: Get container logs
// description: Get stdout and stderr logs from a container.
// parameters:
// - in: path
// name: name
// type: string
// required: true
// description: the name or ID of the container
// - in: query
// name: follow
// type: boolean
// description: Keep connection after returning logs.
// - in: query
// name: stdout
// type: boolean
// description: Return logs from stdout
// - in: query
// name: stderr
// type: boolean
// description: Return logs from stderr
// - in: query
// name: since
// type: string
// description: Only return logs since this time, as a UNIX timestamp
// - in: query
// name: until
// type: string
// description: Only return logs before this time, as a UNIX timestamp
// - in: query
// name: timestamps
// type: boolean
// default: false
// description: Add timestamps to every log line
// - in: query
// name: tail
// type: string
// description: Only return this number of log lines from the end of the logs
// default: all
// produces:
// - application/json
// responses:
// 200:
// description: logs returned as a stream in response body.
// 404:
// $ref: "#/responses/NoSuchContainer"
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/libpod/containers/{name}/logs"), APIHandler(s.Context, generic.LogsFromContainer)).Methods(http.MethodGet)
// swagger:operation POST /libpod/containers/{name}/pause libpod libpodPauseContainer
// ---
// tags:
Expand Down

0 comments on commit 9e9b157

Please sign in to comment.