-
-
Notifications
You must be signed in to change notification settings - Fork 150
修复版本比对异常,日志添加时间类型 #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ package es | |||||
|
|
||||||
| import ( | ||||||
| "context" | ||||||
| "fmt" | ||||||
|
|
||||||
| "github.com/kevwan/go-stash/stash/config" | ||||||
| "github.com/olivere/elastic/v7" | ||||||
|
|
@@ -10,7 +11,7 @@ import ( | |||||
| "github.com/zeromicro/go-zero/core/logx" | ||||||
| ) | ||||||
|
|
||||||
| const es8Version = "8.0.0" | ||||||
| const es8Version = "v8.0.0" | ||||||
|
|
||||||
| type ( | ||||||
| Writer struct { | ||||||
|
|
@@ -22,7 +23,7 @@ type ( | |||||
|
|
||||||
| valueWithIndex struct { | ||||||
| index string | ||||||
| val string | ||||||
| val map[string]interface{} | ||||||
| } | ||||||
| ) | ||||||
|
|
||||||
|
|
@@ -45,13 +46,13 @@ func NewWriter(c config.ElasticSearchConf) (*Writer, error) { | |||||
| writer := Writer{ | ||||||
| docType: c.DocType, | ||||||
| client: client, | ||||||
| esVersion: version, | ||||||
| esVersion: fmt.Sprintf("v%s", version), | ||||||
|
||||||
| esVersion: fmt.Sprintf("v%s", version), | |
| esVersion: "v" + version, |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import ( | |||||
| jsoniter "github.com/json-iterator/go" | ||||||
| "github.com/kevwan/go-stash/stash/es" | ||||||
| "github.com/kevwan/go-stash/stash/filter" | ||||||
| "time" | ||||||
| ) | ||||||
|
|
||||||
| type MessageHandler struct { | ||||||
|
|
@@ -37,11 +38,7 @@ func (mh *MessageHandler) Consume(_, val string) error { | |||||
| return nil | ||||||
| } | ||||||
| } | ||||||
| m["timestamp"] = time.Now() | ||||||
|
||||||
| m["timestamp"] = time.Now() | |
| m["timestamp"] = time.Now().UTC() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant name 'es8Version' suggests Elasticsearch version 8, but the value 'v8.0.0' is hardcoded. Consider renaming to reflect its actual purpose or making it configurable if it represents a minimum version requirement.