All Projects → IBM → fluent-forward-go

IBM / fluent-forward-go

Licence: MIT license
A high-performance Go client for Fluentd and Fluent Bit

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to fluent-forward-go

fluent-bit-go-s3
[Deprecated] The predessor of fluent-bit output plugin for Amazon S3. https://aws.amazon.com/s3/
Stars: ✭ 34 (+30.77%)
Mutual labels:  fluentd, fluent-bit
Logback More Appenders
Extra appenders for Logback.
Stars: ✭ 93 (+257.69%)
Mutual labels:  logger, fluentd
Fluent Bit
Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows
Stars: ✭ 3,223 (+12296.15%)
Mutual labels:  fluentd, fluent-bit
ansible-role-fluentbit
Ansible role that install FluentBit
Stars: ✭ 18 (-30.77%)
Mutual labels:  fluentd, fluent-bit
fluency
High throughput data ingestion logger to Fluentd, AWS S3 and Treasure Data
Stars: ✭ 135 (+419.23%)
Mutual labels:  logger, fluentd
Laravel-FluentLogger
fluent logger for laravel (with Monolog handler for Fluentd)
Stars: ✭ 55 (+111.54%)
Mutual labels:  logger, fluentd
logger
Gin middleware/handler to logger url path using rs/zerolog
Stars: ✭ 119 (+357.69%)
Mutual labels:  logger
pio
Low-level package that provides an easy way to centralize different output targets. Supports colors and text decoration to all popular terminals
Stars: ✭ 21 (-19.23%)
Mutual labels:  logger
Meteor-logger-file
🔖 Meteor Logging: Store application log messages into file (FS)
Stars: ✭ 24 (-7.69%)
Mutual labels:  logger
Fluent-Random-Picker
Fluent Random Picker is a nice, performant, fluent way to pick random values. Probabilities can be specified, values can be weighted.
Stars: ✭ 26 (+0%)
Mutual labels:  fluent
fluent-plugin-gcs
Google Cloud Storage output plugin for Fluentd.
Stars: ✭ 39 (+50%)
Mutual labels:  fluentd
liquibase-slf4j
Liquibase SLF4J Logger.
Stars: ✭ 42 (+61.54%)
Mutual labels:  logger
GoogleCloudLogging
Swift (Darwin) library for logging application events in Google Cloud.
Stars: ✭ 24 (-7.69%)
Mutual labels:  logger
faraday-detailed logger
A detailed request and response logger for Faraday.
Stars: ✭ 56 (+115.38%)
Mutual labels:  logger
Proglog
📝 Logs and progress bars manager for Python
Stars: ✭ 87 (+234.62%)
Mutual labels:  logger
neptune-client
📒 Experiment tracking tool and model registry
Stars: ✭ 348 (+1238.46%)
Mutual labels:  logger
beautiful logger
Yet another logger API in Java with beautiful features
Stars: ✭ 60 (+130.77%)
Mutual labels:  logger
Microsoft.Maui.Graphics.Controls
Experimental Microsoft.Maui.Graphics.Controls - Build drawn controls (Cupertino, Fluent and Material)
Stars: ✭ 549 (+2011.54%)
Mutual labels:  fluent
apollo-log
A logging extension for the Apollo GraphQL Server
Stars: ✭ 64 (+146.15%)
Mutual labels:  logger
studio-log
👻 A tiny JSON logger with emoji support
Stars: ✭ 39 (+50%)
Mutual labels:  logger

fluent-forward-go

fluent-forward-go is a fast, memory-efficient implementation of the Fluent Forward v1 specification. It allows you to send events to Fluentd, Fluent Bit, and other endpoints supporting the Fluent protocol. It also includes a websocket client for high-speed proxying of Fluent events over ports such as 80 and 443.

Features include:

  • TCP, TLS, mTLS, and unix socket transport
  • shared-key authentication
  • support for all Fluent message modes
  • gzip compression
  • ability to send byte-encoded messages
  • ack support
  • a websocket client for proxying Fluent messages

Installation

go get github.com/IBM/fluent-forward-go

Examples

Create a TCP client

c := client.New(client.ConnectionOptions{
  Factory: &client.ConnFactory{
    Address: "localhost:24224",
  },
})
if err := c.Connect(); err != nil {
  // ...
}
defer c.Disconnect()

Create a TLS client

c := client.New(client.ConnectionOptions{
  Factory: &client.ConnFactory{
    Address: "localhost:24224",
    TLSConfig: &tls.Config{InsecureSkipVerify: true},
  },
})
if err := c.Connect(); err != nil {
  // ...
}
defer c.Disconnect()

Send a new log message

The record object must be a map or struct. Objects that implement the msgp.Encodable interface will the be most performant.

record := map[string]interface{}{
  "Hello": "World",
}
err := c.SendMessage("tag", record)

Send a byte-encoded message

err := c.SendRaw(myMessageBytes)

Message confirmation

The client supports ack confirmations as specified by the Fluent protocol. When enabled, Send returns once the acknowledgement is received or the timeout is reached.

Note: For types other than RawMessage, the Send function sets the "chunk" option before sending. A RawMessage is immutable and must already contain a "chunk" value. The behavior is otherwise identical.

c := client.New(client.ConnectionOptions{
  RequireAck: true,
})
//...
err := c.Send(myMsg)

Performance

tl;dr fluent-forward-go is fast and memory efficient.

You can read more about the benchmarks here.

Send

Run on localhost. Does not include message creation.

Benchmark_Fluent_Forward_Go_SendOnly-16      10000      10847 ns/op      0 B/op      0 allocs/op

Comparisons with fluent-logger-golang

The benchmarks below compare fluent-forward-go with the official package, fluent-logger-golang. The message is a simple map with twelve keys.

The differences in execution times can vary from one test run to another. The differences in memory allocations, however, are constant.

Send a single message

Benchmark_Fluent_Forward_Go_SingleMessage-16         10000	     11355 ns/op	      48 B/op	       1 allocs/op
Benchmark_Fluent_Logger_Golang_SingleMessage-16      10000	     19687 ns/op	    2169 B/op	      33 allocs/op

Send a single message with confirmation

Benchmark_Fluent_Forward_Go_SingleMessageAck-16       10000	    768743 ns/op	     185 B/op	       6 allocs/op
Benchmark_Fluent_Logger_Golang_SingleMessageAck-16    10000	    793360 ns/op	    6015 B/op	      47 allocs/op

Developing

Installation instructions

Before running the generate tool, you must have msgp installed. To install run:

go get github.com/tinylib/msgp

Afterwards, generate the msgp packets with:

go generate ./...

Testing

To test against fluent-bit, start up fluent-bit in a docker container with:

docker pull fluent/fluent-bit:1.8.2
docker run -p 127.0.0.1:24224:24224/tcp -v `pwd`:`pwd` -w `pwd` \
  -ti fluent/fluent-bit:1.8.2 /fluent-bit/bin/fluent-bit \
  -c $(pwd)/fixtures/fluent.conf

You can then build and run with:

go run ./cmd/forward -t foo.bar

This will send two regular Messages, one with the timestamp as seconds since the epoch, the other with the timestamp as seconds.nanoseconds. Those will then be written to a file with the same name as the tag supplied as the argument to the -t flag (foo.bar in the above example).

It will also send a ForwardMessage containing a pair of events - these will be written to the same file.

It will then send a PackedForwardMessage containing a pair of events - these will be written to $TAG.packed.

Last, it will send a CompressedPackedForwardMessage with the same pair of events, which should then be written to $TAG.compressed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].