Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] global logging options for docker driver #2904

Closed
pznamensky opened this issue Jul 25, 2017 · 7 comments
Closed

[Improvement] global logging options for docker driver #2904

pznamensky opened this issue Jul 25, 2017 · 7 comments

Comments

@pznamensky
Copy link

Hi,
In the current implementation there is no simple way to ship logs with additional information like task, group or job names to the central server.
Available options were described here: #2631 (comment)
The most flexible and in fact the only option for central logging is configuring logging per task.
In this case your must configure log options for each tasks.
It's not very easy to keep it in sync with lots of tasks.
I guess it would be much easier to customize logging behavior in the global config.
Something like:

client {
  options {
    "docker.logging.syslog.syslog-address" = "tcp://syslog.server:514"
    "docker.logging.syslog.tag" = "{{.ImageName}}/{{.Name}}"
  }
}

Another option is to implement log forwarding from built-in syslog server to remote or local server with adding tag that contains task/group/job name.

@Xopherus
Copy link
Contributor

Is this not possible now with https://www.nomadproject.io/docs/drivers/docker.html#logging ?

config {
  logging {
    type = "syslog"
    config {
      syslog-address: "udp://1.2.3.4:1111"
      tag = "{{.ImageName}}/{{.Name}}"
    }
  }
}

I assume this would work!

As an aside, one kind of annoying thing (at least for my use case) is that docker names are a combination of task + uuid. It would be great to either add job + group to the docker name, or have an additional tag that could be added at container creation. It's pretty common for task names to be common across jobs, which can make it difficult to filter.

@eigengrau
Copy link

@Xopherus it looks like this only works when specified in each job individually. It would be preferable if Docker logging options could be set globally (at least as defaults) for all tasks in the agent configuration.

@gaspo53
Copy link

gaspo53 commented Apr 30, 2020

Hi. Yes, Driver's global configs (and overriden by each stanza) would be really really useful. Is this on the Nomad roadmap?

@bjornicus
Copy link

bjornicus commented Jan 21, 2021

it looks to me like the global docker settings are applied as default, and merged with settings in the job definition. I have:

$ cat /etc/docker/daemon.json
{
  "log-driver": "json-file",
  "raw-logs" : true,
  "log-opts": {
    "max-size": "10m",
    "max-file": "10"
  }
}

and my job definition has

        logging {
          type = "json-file"
          config {
            tag = "app.web-unified"
          }
        }

and when I do docker inspect of the container on the host machine I get:

            "LogConfig": {
                "Type": "json-file",
                "Config": {
                    "max-file": "10",
                    "max-size": "10m",
                    "tag": "app.dashboard"
                }
            },

perhaps that just needs to be mentioned in the docs? Or maybe some users don't have the option to customize the docker daemon config, but if you do this appears to be a workable approach.

@tgross tgross added this to Needs Roadmapping in Nomad - Community Issues Triage Feb 12, 2021
@tgross tgross removed this from Needs Roadmapping in Nomad - Community Issues Triage Mar 4, 2021
@apollo13
Copy link
Contributor

Hi all, I think I fixed this as part of #10156 -- can you verify and if that is true close this issue?

@tgross
Copy link
Member

tgross commented Jun 10, 2021

Yup, thanks @apollo13!

@tgross tgross closed this as completed Jun 10, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants