зеркало из https://github.com/microsoft/docker.git
Merge pull request #32462 from dperny/service-logs-general-availability
Remove experimental from service logs
This commit is contained in:
Коммит
17a3e4511d
|
@ -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),
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
---
|
||||
|
||||
<!-- This file is maintained within the docker/docker Github
|
||||
|
@ -17,14 +16,16 @@ advisory: "experimental"
|
|||
# service logs
|
||||
|
||||
```Markdown
|
||||
Usage: docker service logs [OPTIONS] SERVICE
|
||||
Usage: docker service logs [OPTIONS] SERVICE|TASK
|
||||
|
||||
Fetch the logs of a service
|
||||
Fetch the logs of a service or task
|
||||
|
||||
Options:
|
||||
--details Show extra details provided to logs
|
||||
-f, --follow Follow log output
|
||||
--help Print usage
|
||||
--no-resolve Do not map IDs to Names in output
|
||||
--no-task-ids Do not include task IDs in output
|
||||
--no-trunc Do not truncate output
|
||||
--since string Show logs since timestamp
|
||||
--tail string Number of lines to show from the end of the logs (default "all")
|
||||
-t, --timestamps Show timestamps
|
||||
|
@ -34,6 +35,11 @@ Options:
|
|||
|
||||
The `docker service logs` command batch-retrieves logs present at the time of execution.
|
||||
|
||||
The `docker service logs` command can be used with either the name or ID of a
|
||||
service, or with the ID of a task. If a service is passed, it will display logs
|
||||
for all of the containers in that service. If a task is passed, it will only
|
||||
display logs from that particular task.
|
||||
|
||||
> **Note**: This command is only functional for services that are started with
|
||||
> the `json-file` or `journald` logging driver.
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ Metrics (Prometheus) output for basic container, image, and daemon operations.
|
|||
|
||||
* The top-level [docker deploy](../docs/reference/commandline/deploy.md) command. The
|
||||
`docker stack deploy` command is **not** experimental.
|
||||
* [`docker service logs` command](../docs/reference/commandline/service_logs.md)
|
||||
* [`--squash` option to `docker build` command](../docs/reference/commandline/build.md##squash-an-images-layers---squash-experimental-only)
|
||||
* [External graphdriver plugins](../docs/extend/plugins_graphdriver.md)
|
||||
* [Ipvlan Network Drivers](vlan-networks.md)
|
||||
|
|
|
@ -22,8 +22,6 @@ type logMessage struct {
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) {
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
// we have multiple services here for detecting the goroutine issue #28915
|
||||
|
@ -65,7 +63,6 @@ func countLogLines(d *daemon.Swarm, name string) func(*check.C) (interface{}, ch
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *check.C) {
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "TestServiceLogsCompleteness"
|
||||
|
@ -93,7 +90,6 @@ func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestServiceLogsTail(c *check.C) {
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "TestServiceLogsTail"
|
||||
|
@ -119,7 +115,6 @@ func (s *DockerSwarmSuite) TestServiceLogsTail(c *check.C) {
|
|||
|
||||
func (s *DockerSwarmSuite) TestServiceLogsSince(c *check.C) {
|
||||
// See DockerSuite.TestLogsSince, which is where this comes from
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "TestServiceLogsSince"
|
||||
|
@ -154,8 +149,6 @@ func (s *DockerSwarmSuite) TestServiceLogsSince(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "TestServiceLogsFollow"
|
||||
|
@ -201,8 +194,6 @@ func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) {
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "TestServicelogsTaskLogs"
|
||||
|
@ -256,8 +247,6 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) {
|
||||
testRequires(c, ExperimentalDaemon)
|
||||
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "TestServiceLogsTTY"
|
Загрузка…
Ссылка в новой задаче