Skip to content
Oliver Eilhard edited this page Feb 22, 2015 · 5 revisions

Logging and tracing in Elastic are done on the client-level. A trace file captures all HTTP requests and responses as they are sent to and received from Elasticsearch. Those files can get quite large, so watch out. However, they are very good for debugging.

This traces requests to standard output:

client.SetTracer(log.New(os.Stdout, "", 0))

If you want to log to a file, use something like this:

file, err := os.OpenFile("elastic-trace.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664)
if err != nil {
  panic(err)
}
client.SetLogger(log.New(file, "", log.LstdFlags))
Clone this wiki locally