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

Add a command line argument to set the logConfiguration #731

Merged
merged 7 commits into from
Jan 22, 2016
Merged

Add a command line argument to set the logConfiguration #731

merged 7 commits into from
Jan 22, 2016

Conversation

brianz
Copy link
Contributor

@brianz brianz commented Jan 20, 2016

First cut of configuring the --log-driver for from Empire. Details of this are listed in #704.

In short, this allows controlling the logging driver when Empire starts up. Work remaining to do:

  • add some tests

I tested this and it's working as expected when using empire server --docker.logdriver syslog

I'd appreciate any feedback since this is my first time in Go.

First cut of configuring the ``--log-driver`` for from Empire.  Details of this are listed in #704.

In short, this allows controlling the logging driver when Empire starts up. Work remaining to do:

- validate the values passed in on the command line
- add support for log options
FlagDockerSocket = "docker.socket"
FlagDockerCert = "docker.cert"
FlagDockerAuth = "docker.auth"
FlagDockerLogDriver = "docker.logdriver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should actually live under the ecs.* namespace. The docker.* flags control options for connecting to the local docker daemon.

@ejholmes
Copy link
Contributor

Awesome, other than those comments and tests, this looks like a good first step. It'd be nice if we could also provide a way to pass log driver options, but I don't think it's necessary for the first version.

Change the visibility/scope of `Config` and instead deal with `ecs.logConfiguration` in the
places which need it.

Also add support to accept multiple `ecs.logopt` fields which end up in the docker `--log-opt`
arguments.
cli.StringSliceFlag{
Name: FlagECSLogOpts,
Value: &cli.StringSlice{},
Usage: "Log driver to options. Maps to the --log-opt docker cli arg",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give an example of the format you'd pass here? I'd assume tag=foo,thing=bar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logopt takes multiple arguments, which is exactly how it works with docker run:

empire server --ecs.logdriver syslog --ecs.logopt tag=brianz --ecs.logopt syslog-facility=daemon

...results in:

        "LogConfig": {
            "Type": "syslog",
            "Config": {
                "syslog-facility": "daemon",
                "tag": "brianz"
            }
        },

This makes it more obvious what's running in the list of EC2 instances
Also add some validation around the log driver options.  Restrict to syslog and json-file for now
since the other options would have other consequences which aren't fully tested.
@ejholmes
Copy link
Contributor

Awesome, this looks good to me. If you can rebase on top of master I'll go ahead and merge. 👍

@brianz
Copy link
Contributor Author

brianz commented Jan 22, 2016

Rebasing was pretty gnarly so I merged in master. Thanks again for the guidance @ejholmes.

ejholmes added a commit that referenced this pull request Jan 22, 2016
Add a command line argument to set the logConfiguration
@ejholmes ejholmes merged commit 034890a into remind101:master Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants