Skip to content

Commit

Permalink
Merge pull request #11 from Mikaelemmmm/master
Browse files Browse the repository at this point in the history
add es optional  username、password
  • Loading branch information
kevwan authored Mar 18, 2022
2 parents e6cee8e + 108621d commit 6c5a321
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stash/config/config.go
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ type (
TimeZone string `json:",optional"`
MaxChunkBytes int `json:",default=15728640"` // default 15M
Compress bool `json:",default=false"`
Username string `json:",optional"`
Password string `json:",optional"`
}

Filter struct {
1 change: 1 addition & 0 deletions stash/es/writer.go
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ func NewWriter(c config.ElasticSearchConf) (*Writer, error) {
elastic.SetSniff(false),
elastic.SetURL(c.Hosts...),
elastic.SetGzip(c.Compress),
elastic.SetBasicAuth(c.Username,c.Password),
)
if err != nil {
return nil, err
1 change: 1 addition & 0 deletions stash/stash.go
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ func main() {
client, err := elastic.NewClient(
elastic.SetSniff(false),
elastic.SetURL(processor.Output.ElasticSearch.Hosts...),
elastic.SetBasicAuth(processor.Output.ElasticSearch.Username,processor.Output.ElasticSearch.Password),
)
logx.Must(err)

0 comments on commit 6c5a321

Please sign in to comment.