尝试给上报到elasticsearch的文档加_id

This commit is contained in:
zhangkun 2024-12-04 09:53:13 +08:00
parent ae50c80f4f
commit 1dee8c87a4

View File

@ -20,7 +20,7 @@ func (wg *WriteLog) Process(cr *Core) error {
reqBody := bytes.NewBuffer(wg.Content) reqBody := bytes.NewBuffer(wg.Content)
cr.Env = os.Getenv("GO_ENV") cr.Env = os.Getenv("GO_ENV")
cr.FluentBitUrl = os.Getenv("TEXUS_FluentBitUrl") cr.FluentBitUrl = os.Getenv("TEXUS_FluentBitUrl")
fullUrl := "http://" + cr.FluentBitUrl + "/" + wg.Tag + "/_doc/" + wg.Id fullUrl := "http://" + cr.FluentBitUrl + "/" + wg.Tag
res, err := http.Post(fullUrl, "application/json", reqBody) res, err := http.Post(fullUrl, "application/json", reqBody)
fmt.Println("requested, response:", fullUrl, string(wg.Content), res) fmt.Println("requested, response:", fullUrl, string(wg.Content), res)