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

Syslog doesn't work after upgrade to 0.27 #1523

Closed
drTr0jan opened this issue Oct 19, 2021 · 4 comments · Fixed by #1529
Closed

Syslog doesn't work after upgrade to 0.27 #1523

drTr0jan opened this issue Oct 19, 2021 · 4 comments · Fixed by #1529
Labels
Milestone

Comments

@drTr0jan
Copy link

Consul Template version

consul-template v0.27.1 (release)

Configuration

consul {
  token = "xxx03d94-05f3-xxx2-09f4-xxx171713xxx"
}

log_level = "info"

syslog {
  enabled = true
}

Debug output

2021/10/19 13:26:15 [DEBUG] (logging) enabling syslog on LOCAL0
2021-10-19T13:26:15.046Z [INFO] consul-template v0.27.1 (release)
2021-10-19T13:26:15.046Z [INFO] (runner) creating new runner (dry: false, once: false)

Expected behavior

Messages should be send to syslog.

Actual behavior

Messages send only to stdout.

References

Behavior is broken after #1476.

@eikenb eikenb added the bug label Oct 25, 2021
@eikenb
Copy link
Contributor

eikenb commented Oct 25, 2021

Hey @drTr0jan, thanks for filing the bug and particularly for linking to the culprit. 🙇

I'll look into this and see what I can do this week. Might also see if I can bolster the tests a bit in that area to prevent this from happening again.

@eikenb
Copy link
Contributor

eikenb commented Oct 27, 2021

Found it. The problem is that the logutil.Multiwriter() short circuits the output when one of the Writers used either returns an error (which I knew) OR when the output character count doesn't match the input byte slice (which I didn't know)... it was the latter causing issues.

Specifically this line...

return fmt.Fprintf(writer.out, "%s %s", now(), bytes)

That returns the wrong byte count as it includes the timestamp (so it is always longer).

Fixing...

@eikenb eikenb added this to the v0.27.2 milestone Oct 27, 2021
@eikenb
Copy link
Contributor

eikenb commented Oct 27, 2021

PR up (for internal review).
Once merged I'll look into making a v0.27.2 release with this fix.

@drTr0jan
Copy link
Author

@eikenb, it looks like a workable. Thx.

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Dec 30, 2021
1) Update to 0.27.2:
* syslog bug fixed - hashicorp/consul-template#1523

2) RC-script refactor:
* fixed keyword;
* added consul_template_syslog_output_tag variable, making them consistent with the rest of the ports tree;
* fixed codestyle.

PR: 259711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants