diff --git a/api/server/router/swarm/cluster.go b/api/server/router/swarm/cluster.go index 6f21cf1ee4..cda2eb7bdb 100644 --- a/api/server/router/swarm/cluster.go +++ b/api/server/router/swarm/cluster.go @@ -36,14 +36,14 @@ func (sr *swarmRouter) initRoutes() { router.NewPostRoute("/services/create", sr.createService), router.NewPostRoute("/services/{id}/update", sr.updateService), router.NewDeleteRoute("/services/{id}", sr.removeService), - router.Experimental(router.Cancellable(router.NewGetRoute("/services/{id}/logs", sr.getServiceLogs))), + router.Cancellable(router.NewGetRoute("/services/{id}/logs", sr.getServiceLogs)), router.NewGetRoute("/nodes", sr.getNodes), router.NewGetRoute("/nodes/{id}", sr.getNode), router.NewDeleteRoute("/nodes/{id}", sr.removeNode), router.NewPostRoute("/nodes/{id}/update", sr.updateNode), router.NewGetRoute("/tasks", sr.getTasks), router.NewGetRoute("/tasks/{id}", sr.getTask), - router.Experimental(router.Cancellable(router.NewGetRoute("/tasks/{id}/logs", sr.getTaskLogs))), + router.Cancellable(router.NewGetRoute("/tasks/{id}/logs", sr.getTaskLogs)), router.NewGetRoute("/secrets", sr.getSecrets), router.NewPostRoute("/secrets/create", sr.createSecret), router.NewDeleteRoute("/secrets/{id}", sr.removeSecret), diff --git a/api/swagger.yaml b/api/swagger.yaml index 2154e0cff3..f6e6fc628f 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -7729,12 +7729,12 @@ paths: schema: type: "string" 404: - description: "no such container" + description: "no such service" schema: $ref: "#/definitions/ErrorResponse" examples: application/json: - message: "No such container: c2ada9df5af8" + message: "No such service: c2ada9df5af8" 500: description: "server error" schema: @@ -7747,11 +7747,11 @@ paths: - name: "id" in: "path" required: true - description: "ID or name of the container" + description: "ID or name of the service" type: "string" - name: "details" in: "query" - description: "Show extra details provided to logs." + description: "Show service context and extra details provided to logs." type: "boolean" default: false - name: "follow" @@ -8008,7 +8008,7 @@ paths: type: "string" - name: "details" in: "query" - description: "Show extra details provided to logs." + description: "Show task context and extra details provided to logs." type: "boolean" default: false - name: "follow" diff --git a/cli/command/service/logs.go b/cli/command/service/logs.go index cfcb7ed105..30ed504cfa 100644 --- a/cli/command/service/logs.go +++ b/cli/command/service/logs.go @@ -42,20 +42,22 @@ func newLogsCommand(dockerCli *command.DockerCli) *cobra.Command { var opts logsOptions cmd := &cobra.Command{ - Use: "logs [OPTIONS] SERVICE", - Short: "Fetch the logs of a service", + Use: "logs [OPTIONS] SERVICE|TASK", + Short: "Fetch the logs of a service or task", Args: cli.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.target = args[0] return runLogs(dockerCli, &opts) }, - Tags: map[string]string{"experimental": ""}, + Tags: map[string]string{"version": "1.29"}, } flags := cmd.Flags() + // options specific to service logs flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names in output") flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") flags.BoolVar(&opts.noTaskIDs, "no-task-ids", false, "Do not include task IDs in output") + // options identical to container logs flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output") flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)") flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") @@ -94,6 +96,8 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error { tty = task.Spec.ContainerSpec.TTY // TODO(dperny) hot fix until we get a nice details system squared away, // ignores details (including task context) if we have a TTY log + // if we don't do this, we'll vomit the huge context verbatim into the + // TTY log lines and that's Undesirable. if tty { options.Details = false } diff --git a/docs/reference/commandline/service_logs.md b/docs/reference/commandline/service_logs.md index 844a58e0cf..fd328d0f6d 100644 --- a/docs/reference/commandline/service_logs.md +++ b/docs/reference/commandline/service_logs.md @@ -1,8 +1,7 @@ --- -title: "service logs (experimental)" +title: "service logs" description: "The service logs command description and usage" -keywords: "service, logs" -advisory: "experimental" +keywords: "service, task, logs" ---