Description
• go-rethinklogger persists and bundles all your logs from `stdio` and `stderr` to RethinkDB.
• Can be used to monitor logs and analytics of your GO application remotely.
• It works and is compatible with literally all types of loggers. The API is exceptionally simple and you just need to do normal logging,
it automatically reads from `stdio` and `stderr`, persists logs for later use and echoes the same back to their respective streams.
go-rethinklogger alternatives and similar packages
Based on the "Logging" category.
Alternatively, view go-rethinklogger alternatives based on common mentions on social networks and blogs.
-
seelog
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting. -
loggo
A logging library for Go. Doesn't use the built in go log standard library, but instead offers a replacement. -
ozzo-log
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets. -
gologger
Simple easy to use log lib for go, logs in Colored Cosole, Simple Console, File or Elasticsearch. -
noodlog
🍜 Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content. -
Kiwi Logs&Context
Fast, structured, with filters and dynamic sinks. No levels. Logger & context keeper for Go language 🥝 It smells like a mushroom. -
gomol
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs -
kemba
A tiny debug logging tool. Ideal for CLI tools and command applications. Inspired by https://github.com/visionmedia/debug
InfluxDB - Power Real-Time Data Analytics at Scale
Do you think we are missing an alternative of go-rethinklogger or a related project?
README
go-rethinklogger
go-rethinklogger persists and bundles all your logs from stdio
and stderr
to RethinkDB.
• Can be used to monitor logs and analytics of your GO application remotely.
• It works and is compatible with literally all types of loggers. The API is exceptionally simple and you just need to do normal logging,
it automatically reads from stdio
and stderr
, persists logs for later use and echoes the same back to their respective streams.
Installation.
• Using Go.
go get github.com/MustansirZia/go-rethinklogger
• Using Glide.
glide get github.com/MustansirZia/go-rethinklogger
glide up
• Using go-vendor.
govendor fetch github.com/MustansirZia/go-rethinklogger
Usage.
// Start persisting logs. Call preferably from init.
// Start takes a rethinkDB address and the admin password
// as arguments. Don't worry though, admin user is only
// used to create the database and a user.
rethinklogger.Start("localhost:28015", "adminPassword")
fmt.Fprintln(os.Stdout, "Sample stdio log!")
fmt.Fprintln(os.Stderr, "Sample stderr log!")
...
...
// Query logs from anywhere in your application.
previousDay := time.Now().Add(0, 0, -1)
now := time.Now()
logs, err := rethinklogger.QueryLogs("localhost:28015", previousDay, now)
if err != nil {
fmt.Println(err.Error())
}
for _, log := range logs {
/*
log {
Log = "Sample stdio log!"
CreatedAtHuman = "17 Aug 17 15:04 +530"
CreatedAt = 1503162020
}
log {
Log = "Sample stderr log!"
CreatedAtHuman = "17 Aug 17 15:04 +530"
CreatedAt = 1503162020
}
*/
}
Sidenotes.
• This library is built over go-shipit which dispatches std logs to a io.Writer
interface. This library is basically a writer for shipit.
• To avoid our database from getting overwhelmed by logs, logs are first accumulated inside a buffer and then dispatched at an interval of 5 secs.
• Logging can also be started using StartWithBuffer
function which takes an additional buffer size argument. This is the minimum number of logs that must be accumulated inside the buffer before all the logs are dispatched to Rethink.
By default the value is 1
.
Inspiration.
=> go-loggly - https://github.com/segmentio/go-loggly => Winston for nodejs - https://github.com/winstonjs/winston
License.
See License.
*Note that all licence references and agreements mentioned in the go-rethinklogger README section above
are relevant to that project's source code only.