@steffens May I ask in which file you saw that I'm using the cmd/instance
directly? I suppose it was main.go
but when I generate a new beat based on metricbeat with the command python ${GOPATH}/src/github.com/elastic/beats/script/generate.py --type=metricbeat
I'll get a main.go
file more or less the same as the one I got?
Based on the 6.0 branch of metricbeat
package main
import (
"os"
"github.com/elastic/beats/libbeat/cmd/instance"
"github.com/elastic/beats/metricbeat/beater"
// Comment out the following line to exclude all official metricbeat modules and metricsets
_ "github.com/elastic/beats/metricbeat/include"
// Make sure all your modules and metricsets are linked in this file
_ "github.com/dcroonen/examplebeat/include"
)
var Name = "examplebeat"
func main() {
if err := instance.Run(Name, "", beater.New); err != nil {
os.Exit(1)
}
}
and based on the master branch of metricbeat:
package main
import (
"os"
"github.com/elastic/beats/libbeat/cmd/instance"
"github.com/elastic/beats/metricbeat/beater"
// Comment out the following line to exclude all official metricbeat modules and metricsets
_ "github.com/elastic/beats/metricbeat/include"
// Make sure all your modules and metricsets are linked in this file
_ "github.com/dcroonen/masterbeat/include"
)
var Name = "masterbeat"
var IndexPrefix = "masterbeat"
func main() {
if err := instance.Run(Name, IndexPrefix, "", beater.DefaultCreator()); err != nil {
os.Exit(1)
}
}
So at the moment I don't have clue where to look to hook in the sub commands again....