Merge pull request #61 from navi-ppl/TP-5555/limit-logs
NTP-19782 | custom trace config
This commit is contained in:
@@ -17,7 +17,7 @@ type Logger struct {
|
||||
var Log *Logger
|
||||
|
||||
func initiateLogger() *zap.Logger {
|
||||
config := zap.NewProductionConfig()
|
||||
config := NewCustomZapConfig()
|
||||
config.EncoderConfig = ecszap.ECSCompatibleEncoderConfig(config.EncoderConfig)
|
||||
log, err := config.Build(ecszap.WrapCoreOption(), zap.AddCallerSkip(1))
|
||||
log = log.With(zap.String("service", "cybertron"))
|
||||
|
||||
27
pkg/log/zapConfig.go
Normal file
27
pkg/log/zapConfig.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewCustomZapConfig() zap.Config {
|
||||
rawJSON := []byte(`{
|
||||
"level": "debug",
|
||||
"development": false,
|
||||
"sampling": {
|
||||
"initial": 100,
|
||||
"thereafter": 100
|
||||
},
|
||||
"disableCaller": true,
|
||||
"encoding": "json",
|
||||
"OutputPaths": ["stdout"],
|
||||
"ErrorOutputPaths": ["stderr"]
|
||||
}`)
|
||||
|
||||
var cfg zap.Config
|
||||
if err := json.Unmarshal(rawJSON, &cfg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
@@ -120,7 +120,7 @@ func (s *SearchService) GetErrorListV2(c *gin.Context) {
|
||||
final_terms_aggs_query := utils.CreateAggregationQuery(terms_aggs_query_with_name)
|
||||
final_query := utils.CreateEsQuery(search_query, size_query, final_terms_aggs_query)
|
||||
|
||||
println("final query %v", final_query)
|
||||
//println("final query %v", final_query)
|
||||
fields := []string{"error", "significant_stack", "title"}
|
||||
var _, aggs, total, err = s.elasticSearchClient.SearchDocuments(final_query, fields)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user