moved Sirupsen to sirupsen on a case sensitive system
Signed-off-by: Igor Morozov <igor@adhoc05-sjc1.prod.uber.internal>
This commit is contained in:
parent
1e2f10eb65
commit
a97d7c0c15
45 changed files with 474 additions and 247 deletions
19
vendor/github.com/bshuster-repo/logrus-logstash-hook/README.md
generated
vendored
19
vendor/github.com/bshuster-repo/logrus-logstash-hook/README.md
generated
vendored
|
@ -7,13 +7,13 @@ Use this hook to send the logs to [Logstash](https://www.elastic.co/products/log
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/bshuster-repo/logrus-logstash-hook"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log := logrus.New()
|
||||
hook, err := logrus_logstash.NewHook("tcp", "172.17.0.2:9999", "myappName")
|
||||
hook, err := logrustash.NewHook("tcp", "172.17.0.2:9999", "myappName")
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -47,7 +47,7 @@ This can be done when creating the hook:
|
|||
|
||||
```go
|
||||
|
||||
hook, err := logrus_logstash.NewHookWithFields("tcp", "172.17.0.2:9999", "myappName", logrus.Fields{
|
||||
hook, err := logrustash.NewHookWithFields("tcp", "172.17.0.2:9999", "myappName", logrus.Fields{
|
||||
"hostname": os.Hostname(),
|
||||
"serviceName": "myServiceName",
|
||||
})
|
||||
|
@ -83,7 +83,7 @@ For example if you don't want to see the hostname and serviceName on each log li
|
|||
```go
|
||||
|
||||
|
||||
hook, err := logrus_logstash.NewHookWithFields("tcp", "172.17.0.2:9999", "myappName", logrus.Fields{
|
||||
hook, err := logrustash.NewHookWithFields("tcp", "172.17.0.2:9999", "myappName", logrus.Fields{
|
||||
"_hostname": os.Hostname(),
|
||||
"_serviceName": "myServiceName",
|
||||
})
|
||||
|
@ -93,3 +93,14 @@ hook.WithPrefix("_")
|
|||
|
||||
There are also constructors available which allow you to specify the prefix from the start.
|
||||
The std-out will not have the '\_hostname' and '\_servicename' fields, and the logstash output will, but the prefix will be dropped from the name.
|
||||
|
||||
|
||||
# Authors
|
||||
|
||||
Name | Github | Twitter |
|
||||
------------ | --------- | ---------- |
|
||||
Boaz Shuster | ripcurld0 | @ripcurld0 |
|
||||
|
||||
# License
|
||||
|
||||
MIT.
|
||||
|
|
8
vendor/github.com/bshuster-repo/logrus-logstash-hook/logstash.go
generated
vendored
8
vendor/github.com/bshuster-repo/logrus-logstash-hook/logstash.go
generated
vendored
|
@ -1,10 +1,10 @@
|
|||
package logrus_logstash
|
||||
package logrustash
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Hook represents a connection to a Logstash instance
|
||||
|
@ -13,6 +13,7 @@ type Hook struct {
|
|||
appName string
|
||||
alwaysSentFields logrus.Fields
|
||||
hookOnlyPrefix string
|
||||
TimeFormat string
|
||||
}
|
||||
|
||||
// NewHook creates a new hook to a Logstash instance, which listens on
|
||||
|
@ -106,6 +107,9 @@ func (h *Hook) Fire(entry *logrus.Entry) error {
|
|||
}
|
||||
|
||||
formatter := LogstashFormatter{Type: h.appName}
|
||||
if h.TimeFormat != "" {
|
||||
formatter.TimestampFormat = h.TimeFormat
|
||||
}
|
||||
|
||||
dataBytes, err := formatter.FormatWithPrefix(entry, h.hookOnlyPrefix)
|
||||
if err != nil {
|
||||
|
|
7
vendor/github.com/bshuster-repo/logrus-logstash-hook/logstash_formatter.go
generated
vendored
7
vendor/github.com/bshuster-repo/logrus-logstash-hook/logstash_formatter.go
generated
vendored
|
@ -1,11 +1,11 @@
|
|||
package logrus_logstash
|
||||
package logrustash
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Formatter generates json in logstash format.
|
||||
|
@ -44,8 +44,7 @@ func (f *LogstashFormatter) FormatWithPrefix(entry *logrus.Entry, prefix string)
|
|||
timeStampFormat := f.TimestampFormat
|
||||
|
||||
if timeStampFormat == "" {
|
||||
//timeStampFormat = logrus.DefaultTimestampFormat
|
||||
timeStampFormat = "2006-01-02 15:04:05.000"
|
||||
timeStampFormat = logrus.DefaultTimestampFormat
|
||||
}
|
||||
|
||||
fields["@timestamp"] = entry.Time.Format(timeStampFormat)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue