gologz helps you searching hits on Logz.io platform by simple or aggregated map query's
go get github.com/stacknowledge/gologz
package main
import (
"fmt"
"github.com/stacknowledge/gologz"
)
func main() {
client := gologz.New("YOUR-LOGZ.IO-API-TOKEN", "eu") // Accepts EU or US regions
// query, start index, limit, you can also compose a query with AND/OR selector
// like when_ts:1521504127731 AND commit_hash:70793d6aee43b22ba08c5b95
traces, err := client.Trace("when_ts:1521504127731", 0, 5)
if err != nil {
fmt.Errorf("%s", err)
}
for index := range traces.Logs {
fmt.Println(traces.Logs[index].When, traces.Logs[index].Service, traces.Logs[index].Log)
}
}
package main
import (
"fmt"
"github.com/stacknowledge/gologz"
)
func main() {
client := gologz.New("YOUR-LOGZ.IO-API-TOKEN", "eu") // Accepts EU or US regions
traces, err = client.TracePairs(map[string]interface{}{
"when_ts": 1521504127731,
"commit_hash": "70793d6aee43b22ba08c5b956761bba93b85fa75",
}, 0, 5) // Aggregate map, start index, limit
if err != nil {
fmt.Errorf("%s", err)
}
for index := range traces.Logs {
fmt.Println(traces.Logs[index].When, traces.Logs[index].Service, traces.Logs[index].Log)
}
}