2023-11-01 11:17:34 +00:00
|
|
|
# git.frostfs.info/TrueCloudLab/frostfs-observability/loki"
|
|
|
|
|
|
|
|
A simple asynchronous client in Go for sending logs to Loki.
|
|
|
|
|
2023-11-02 09:22:15 +00:00
|
|
|
## Usage
|
2023-11-01 11:17:34 +00:00
|
|
|
|
|
|
|
```go
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/logging/lokicore/loki"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
loki := loki.Setup(loki.Config{
|
|
|
|
Address: "localhost:3100/api/prom/push",
|
|
|
|
Labels: map[string]string{
|
|
|
|
"label": "test",
|
|
|
|
},
|
|
|
|
BatchWait: 1000,
|
|
|
|
BatchEntriesNumber: 200,
|
|
|
|
Enabled: true,
|
|
|
|
})
|
|
|
|
defer loki.Shutdown()
|
|
|
|
|
|
|
|
loki.Send("log message", time.Now())
|
|
|
|
}
|
|
|
|
|
2023-11-02 09:22:15 +00:00
|
|
|
```
|