Config.go don't react to any changes


I followed tutorial how to create your own beat ( I found strange behavior, I might be doing something wrong, please correct me. I edited config/config.go and added string to struct:
type Config struct {
Period time.Duration config:"period"
ProcessCommand string config:"ProcessCommand"

var DefaultConfig = Config{
Period: 1 * time.Second,
ProcessCommand: "ps aux",

After that I added to _meta/beat.yml:
ProcessCommand: 'ps aux'
Under my beat section.

After that I wanted to use it in my beater/xxx.go like:
s := strings.Split(bt.config.ProcessCommand, ":::")

But It didn't work, I received message during build:
beater/xxx.go:101:31: bt.config.ProcessCommand undefined (type config.Config has no field or method ProcessCommand)
vendor/ recipe for target 'xxx' failed
make: *** [sysusage] Error 2

What's intresting, I built this beat (for first time from tutorial) with default config.go where you have Path. After I deleted Path string from config struct in config.go I was able to build beat with:
s := strings.Split(bt.config.Path, ":::")
When the Path don't exist in config.go

I commented in config.go:
Period: 1 * time.Second
It didn't affect build at all. It was still able to build without Path and Period in config.go. What am i doing wrong?


I found my mistake. I had wrong path in import {} to config.go. Sorry for trouble.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.