Giter Club home page Giter Club logo

go-lumber's Introduction

go-lumber

ci Go Report Card Contributors GitHub release

Lumberjack protocol client and server implementations for go.

Example Server

There is an example server in cmd/tst-lj. It will accept connections and log when it receives batches of events.

# Install to $GOPATH/bin.
go install github.com/elastic/go-lumber/cmd/tst-lj@latest

# Start server.
tst-lj -bind=localhost:5044 -v2
2022/08/14 00:13:54 Server config: server.options{timeout:30000000000, keepalive:3000000000, decoder:(server.jsonDecoder)(0x100d88e80), tls:(*tls.Config)(nil), v1:false, v2:true, ch:(chan *lj.Batch)(nil)}
2022/08/14 00:13:54 tcp server up

go-lumber's People

Contributors

andrewkroh avatar andrewthad avatar apmmachine avatar ph avatar reakaleek avatar tengattack avatar v1v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-lumber's Issues

Logstash compressed messages

Greetings!

I'm implementing a Filebeats reader with the lumberjack protocol in Elixir.

What I've noticed so far is that upon connection Filebeat sends me a Window frame together with a Compressed one. These ones I manage to parse, inflate and read several JSON events. But after that Filebeats sends me a bunch of weird frames not mentioned anywhere in the protocol docs. Are those frames the continuation of the first compressed one filebeats sent me? I thoght I would receive only "whole frames" to parse thanks to TCP. Am I getting something wrong here?

Thanks a lot for you attention!

If listener.Accept returns an error then the server stops responding

For example, here:

func (s *server) run() {
	defer s.wg.Done()
	for {
		client, err := s.netListener.Accept()
		if err != nil {
			break
		}

		s.handle(client)
	}
}

netListener is commonly a TLS listener, which can return an error from Accept for many reasons. Breaking out of the loop stops the server from accepting new connections. And, as far as I can tell, there is no way to know from the outside (since run gets called in a goroutine) that this has happened.

[question] Protocol documentation?

I am searching the protocol documentation (frame, encoding etc...) in order to implement it with Java (or maybe a Java impl already exist?).

Server-side pipelining

Hi, I am using go-lumber to write a server that can process some beats logs. I found that my server was only processing one batch per lj connection at a time. I was able to get concurrent batches by making DefaultHandler's ack-signaling channel buffered, so we don't block here when there is an outstanding un-ACKed batch. Is there a chance we can get something like that? I'd be happy to work on a PR if it helps the cause!

Can we bump up the package version of klauspost/compress in go.mod?

The current klauspost/compress version is at v1.11.2 (updated 2 years ago), while the latest compress package version is v1.15.9. The newer versions have included quite some optimizations on flate package, which powers the zlib package used by go-lumber.

Furthermore, we might want to just setup a dependabot to update the package version if it's an option for this repository. Some example of setting this up:
https://bl.ocks.org/magnetikonline/6f215db058e327905bce66c37f92426c

Add protocol spec/description

Reference: urso/go-lumber-old#4

There is a protocol description for the old Lumberjack protocol at https://github.com/logstash-plugins/logstash-input-beats/blob/v2.0.0/PROTOCOL.md but I'm missing like this for the Beats protocol.

While having a working library for the Lumberjack/Beats protocol is nice and a specification could be "reverse engineered" by looking at the Go code, it would be great if a textual protocol spec of the Lumberjack (v1) and Beats (v2) protocols existed.

CRL support

I have implemented a change to support CRLs into go-lumber, but the implementation is lacking. I'm wondering if anyone has any suggestions on how I can improve it. You can see my current change here: master...jsmaupin:crls.

Some of the issues I see are:

  1. CRLs are now supported in Go since 1.15, so this version is required as I used some of the new functions
  2. The Go standard packages do not directly support checking client certificates against CRLs, so that needed to be implemented. It only has implementations for loading CRLs.
  3. Because of (2), I CRLs is a first class option next to the TLS option.

I'm thinking that maybe a callback mechanism would make more sense? Any thoughts?

Possible race condition in ReceiveAck

In ReceiveAck we first set a deadline on the read at

if err := c.setReadDeadline(); err != nil {

And then do the read a few lines later at:

n, err := c.conn.Read(msg[ackBytes:])

If the conn is ever replaced in between those calls, the Read can run forever, this means Receive Ack could wait forever waiting for Acks that will never arrive, because the conn they would come in on has been closed, and no Acks will arrive on the new conn.

This can happen if another go routine can replace the conn.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.