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

Buffer connectable log devices #35

Merged
merged 8 commits into from
Sep 21, 2015
Merged

Buffer connectable log devices #35

merged 8 commits into from
Sep 21, 2015

Conversation

dwbutler
Copy link
Owner

This throws connectable log devices (such as TCP, UDP, and Redis) behind Stud::Buffer in an attempt to improve reliability. In my testing, I have verified that log messages do get buffered, and will retry if an exception is thrown.

However, I have found that sockets don't always raise an exception right away when the server side of the socket is closed. See http://stackoverflow.com/questions/2530652/ruby-tcpsocket-doesnt-notice-it-when-server-is-killed and https://www.ruby-forum.com/topic/148532. This means that some messages will inevitably get lost. Logstash does not return any sort of reply to acknowledge that it received the message, so it's impossible to tell if the message was sent successfully if no exception is raised.

Log messages are written out one at a time. This way, if an exception is raised, the whole batch of messages is retried, and messages are less likely to be lost. However, this does result in duplicate log messages being delivered. Logstash's uuid filter looks like a promising way of dealing with duplicate log messages.

This should fix #34

* master:
  Version bump [ci skip]
  Add note about log level getting changed to troubleshooting section [ci skip]
  Support for logging to Kafka
  Version bump [ci skip]
  Fixed logger spec
  Added troubleshooting notes [ci skip]
  Updated changelog and contributor list
  Logger spec cleanup
  Cleanup of the configuration feature
  Check for config to be #call-able, not just non-nil
  Customize events with a blocK
  No need to explicitly check for String type
  Allow custom_fields to be strings or callable
  Update README.md
  Logging custom metadata, with tests and documentation
  Add appname to logged json object
@hwo411
Copy link

hwo411 commented Sep 16, 2015

@dwbutler Will this one get released?

@dwbutler
Copy link
Owner Author

@hwo411 I do plan to release this eventually, when I find the time to revive this branch. If I bring it up to date with master, would you be willing to try out the branch and let me know how well it works for you?

* master: (40 commits)
  Version bump [ci skip]
  Remove unnecessary tagged logging implementation from MultiLogger
  Version bump [ci skip]
  Support for logging to syslog
  Version bump + docs [ci skip]
  Readme cleanup [ci skip]
  Cleanup
  Fixes support for tagged logging in Multi Logger
  Fixes support for tagged logging in custom formatters
  Fixes MultiLogger under Rails 3.2
  Support for multiple loggers
  Documentation update [ci skip]
  Update to prettier badges [ci skip]
  Codecov badge [ci skip]
  Set up Codecov
  Add note about known issue with UDP output [ci skip]
  Updated contributor list [ci skip]
  Version bump [ci skip]
  Use Travis CI container architecture
  Updated readme [ci skip]
  ...

Conflicts:
	lib/logstash-logger/device/redis.rb
dwbutler added a commit that referenced this pull request Sep 21, 2015
@dwbutler dwbutler merged commit 368f7fa into master Sep 21, 2015
@dwbutler dwbutler deleted the buffer-connectable branch September 21, 2015 12:46
@dwbutler
Copy link
Owner Author

Released in 0.15.0.

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

Successfully merging this pull request may close these issues.

LogStashLogger::Device::TCP - Errno::EPIPE - Broken pipe
2 participants