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

provide -admin-access-log-path #5858

Merged
merged 4 commits into from
Jun 7, 2019
Merged

Conversation

hanshasselberg
Copy link
Member

Fixes #5231.

@hanshasselberg hanshasselberg requested a review from a team May 16, 2019 15:28
@pearkes pearkes added this to the 1.5.1 milestone May 17, 2019
Copy link
Contributor

@freddygv freddygv left a comment

Choose a reason for hiding this comment

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

This looks good to me, just have a couple of questions (one inline and one below):

In the original issue one of the use cases was to output access logs to stdout, how would they do that with this flag?

@@ -258,13 +263,19 @@ func (c *cmd) templateArgs() (*BootstrapTplArgs, error) {
cluster = c.sidecarFor
}

adminAccessLogPath := c.adminAccessLogPath
if len(adminAccessLogPath) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be a little clearer with if adminAccessLogPath == ""? Since it's a string.

Copy link
Member Author

Choose a reason for hiding this comment

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

I always wonder about the same thing and I read the first answer of https://stackoverflow.com/questions/18594330/what-is-the-best-way-to-test-for-an-empty-string-in-go. If you find == "" better, I would be happy to change it. I don't have an opinion on this one.

Copy link
Contributor

@freddygv freddygv May 20, 2019

Choose a reason for hiding this comment

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

I think == "" would be clearer and more consistent. I did a search through the Consul repo and found that len(x) == 0 didn't seem to ever be used with strings.

Thanks!

@hanshasselberg
Copy link
Member Author

hanshasselberg commented May 20, 2019

In the original issue one of the use cases was to output access logs to stdout, how would they do that with this flag?

You can provide that flag on the commandline and it will show the admin access logs on stdout.

@banks
Copy link
Member

banks commented May 20, 2019

This is probably what you want to do in production anyways to make sure it is being restarted and monitored.

Just for the record, using the exec feature of consul connect envoy is also perfectly valid in production provided you are supervising that and restarting on crashes etc. The -bootstrap option is useful when you are running Envoy in a container and want to use the official Envoy image without having to build your own hybrid with both consul and envoy binaries.

Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

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

I think we should be more explicit about the default being /dev/null in the comments and usage text rather than suggesting that is an option for the user.

I also think it would be consistent with other fields to actually apply that default even if the struct is empty in the handling code (like we do with agent address etc) but it isn't really a big deal either way and fine as it is!

Approving as this is fine to merge but the usage comment update would be nice IMO!

@@ -27,6 +27,11 @@ type BootstrapTplArgs struct {
// TLS is enabled.
AgentCAFile string

// AdminAccessLogPath The path to write the access log for the
// administration server. If no access log is desired specify
// "/dev/null".
Copy link
Member

Choose a reason for hiding this comment

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

Should we just make /dev/null be the default so specifying empty is also valid? This is kinda internal only but we do a bunch of default setting before the template already so this seems like a reasonable approach here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made it so that it can also be left empty and then the default would be picked up.

@hanshasselberg
Copy link
Member Author

@banks I changed the comments and flag description as well as my comment above re how to run envoy. 👍

@mkeeler mkeeler modified the milestones: 1.5.1, 1.5.2 May 23, 2019
@hanshasselberg hanshasselberg merged commit 4d9116d into master Jun 7, 2019
@hanshasselberg hanshasselberg deleted the admin_access_log_path branch June 7, 2019 09:26
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.

Consul Connect - Ability to configure envoy access_log_path
5 participants