vendor: github.com/bshuster-repo/logrus-logstash-hook v1.1.0

- adds go.mod
- DefaultFormatter now uses RFC3339Nano as default

full diff: https://github.com/bshuster-repo/logrus-logstash-hook/compare/v1.0.0...v1.1.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-02-12 18:37:03 +01:00
parent c4a0bd3fe9
commit 10e0e8e4c0
6 changed files with 28 additions and 27 deletions

2
go.mod
View File

@@ -9,7 +9,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0
github.com/aws/aws-sdk-go v1.55.5
github.com/bshuster-repo/logrus-logstash-hook v1.0.0
github.com/bshuster-repo/logrus-logstash-hook v1.1.0
github.com/coreos/go-systemd/v22 v22.5.0
github.com/distribution/reference v0.6.0
github.com/docker/docker-credential-helpers v0.9.5

4
go.sum
View File

@@ -56,8 +56,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bshuster-repo/logrus-logstash-hook v1.0.0 h1:e+C0SB5R1pu//O4MQ3f9cFuPGoOVeF2fE4Og9otCc70=
github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
github.com/bshuster-repo/logrus-logstash-hook v1.1.0 h1:o2FzZifLg+z/DN1OFmzTWzZZx/roaqt8IPZCIVco8r4=
github.com/bshuster-repo/logrus-logstash-hook v1.1.0/go.mod h1:Q2aXOe7rNuPgbBtPCOzYyWDvKX7+FpxE5sRdvcPoui0=
github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=

View File

@@ -1,16 +0,0 @@
language: go
sudo: false
go:
- "1.11.x"
- "1.12.x"
- "tip"
install:
- # Skip
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d .)
- go vet .
- go test -v -race ./...

View File

@@ -47,11 +47,18 @@ This is how it will look like:
}
```
# FAQ
Q: I would like to add characters to each line before sending to Logstash?
A: Logrustash gives you the ability to mutate the message before sending it to Logstash. Just follow [this example](https://github.com/bshuster-repo/logrus-logstash-hook/issues/60#issuecomment-604948272).
Q: Is there a way to maintain the connection when it drops
A: It's recommended to use [GoAutoSocket](https://github.com/firstrow/goautosocket) for that. See [here](https://github.com/bshuster-repo/logrus-logstash-hook/issues/48#issuecomment-361938249) how it can be done.
# Maintainers
Name | Github | Twitter |
------------ | --------- | ---------- |
Boaz Shuster | ripcurld0 | @ripcurld0 |
Name | Github |
------------ | --------- |
Boaz Shuster | boaz0 |
# License

View File

@@ -1,8 +1,10 @@
package logrustash
import (
"fmt"
"io"
"sync"
"time"
"github.com/sirupsen/logrus"
)
@@ -12,7 +14,6 @@ import (
// formatter to format the entry to a Logstash format before sending.
//
// To initialize it use the `New` function.
//
type Hook struct {
writer io.Writer
formatter logrus.Formatter
@@ -64,6 +65,12 @@ func copyEntry(e *logrus.Entry, fields logrus.Fields) *logrus.Entry {
ne.Level = e.Level
ne.Time = e.Time
ne.Data = logrus.Fields{}
if e.HasCaller() {
ne.Data["function"] = e.Caller.Function
ne.Data["file"] = fmt.Sprintf("%s:%d", e.Caller.File, e.Caller.Line)
}
for k, v := range fields {
ne.Data[k] = v
}
@@ -110,8 +117,11 @@ func DefaultFormatter(fields logrus.Fields) logrus.Formatter {
}
return LogstashFormatter{
Formatter: &logrus.JSONFormatter{FieldMap: logstashFieldMap},
Fields: fields,
Formatter: &logrus.JSONFormatter{
FieldMap: logstashFieldMap,
TimestampFormat: time.RFC3339Nano,
},
Fields: fields,
}
}

4
vendor/modules.txt vendored
View File

@@ -187,8 +187,8 @@ github.com/aws/aws-sdk-go/service/sts/stsiface
# github.com/beorn7/perks v1.0.1
## explicit; go 1.11
github.com/beorn7/perks/quantile
# github.com/bshuster-repo/logrus-logstash-hook v1.0.0
## explicit
# github.com/bshuster-repo/logrus-logstash-hook v1.1.0
## explicit; go 1.16
github.com/bshuster-repo/logrus-logstash-hook
# github.com/cenkalti/backoff/v4 v4.3.0
## explicit; go 1.18