Config.go don't react to any changes

Hi

I followed tutorial how to create your own beat (https://www.elastic.co/guide/en/beats/devguide/current/new-beat.html). 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/github.com/elastic/beats/libbeat/scripts/Makefile:99: 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?

Regards,
KM

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

Regards,
KM

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