What is the role of unpack,(/libbeat/common/cfgfile.go)?

  1. I check the source code found after the path is Unpack () function set to '/tmp', but the source seems to have no relevant settings inside;
  2. I use "go build main.go" generated executable file, the implementation does not need '/tmp' path, why?
  1. I check the source code found after the path is Unpack () function set to '/tmp', but the source seems to have no relevant settings inside;

Unpack is used for 'unpacking' a configuration object into a go struct. Somewhat similar to json.Unmarshal.

I have no idea what you mean by "function set to '/tmp'". The Unpack method works on an already read/and parsed file.

  1. I use "go build main.go" generated executable file, the implementation does not need '/tmp' path, why?

Just use make or go build, to build the beat.

I don't really understand what your actual problem is. Do you have some logs?

Thanks very much for answering my question.
I created my own beats according to https://www.elastic.co/guide/en/beats/devguide/current/beater-interface.html#beater-interface
but when i run it, there was a error: Exiting: error initializing publisher: Error loading template /tmp/axtx_beat.template.json: open /tmp/axtx_beat.template.json: no such file or directory.
After debugging, I found before Unpack path is NULL, after Unpack the path settings are shown in the attachment
In fact, I want to modify the path in the attachment and change them to my own path, so what should I do?

caibaoying3@163.com

发件人: Steffen Siering
发送时间: 2017-09-11 20:09
收件人: caibaoying3
主题: [Beats] What is the role of unpack,(/libbeat/common/cfgfile.go)?
steffens Steffen Siering Elastic Team Member
September 11
I check the source code found after the path is Unpack () function set to '/tmp', but the source seems to have no relevant settings inside;
Unpack is used for 'unpacking' a configuration object into a go struct. Somewhat similar to json.Unmarshal.
I have no idea what you mean by "function set to '/tmp'". The Unpack method works on an already read/and parsed file.
I use "go build main.go" generated executable file, the implementation does not need '/tmp' path, why?
Just use make or go build, to build the beat.
I don't really understand what your actual problem is. Do you have some logs?

Visit Topic or reply to this email to respond.
To unsubscribe from these emails, click here.

This makes me wonder in which directory your IDE is building or running the executable. If you just build and run the beat, the default ${path} is set to the current working directory. Which in your case is /tmp. That is, your IDE sets the working directory to /tmp, not the beat.

To learn something about 'paths' check out this documentation (it's the same for all beats): https://www.elastic.co/guide/en/beats/filebeat/current/directory-layout.html

You can try to pass -path.home <path to dev directory> to the application arguments in your IDE. This should set all path variables to the correct path.

Thanks a lot. I will try to modify it.

caibaoying3@163.com

发件人: Steffen Siering
发送时间: 2017-09-12 20:53
收件人: caibaoying3
主题: [Beats] What is the role of unpack,(/libbeat/common/cfgfile.go)?
steffens Steffen Siering Elastic Team Member
September 12
This makes me wonder in which directory your IDE is building or running the executable. If you just build and run the beat, the default ${path} is set to the current working directory. Which in your case is /tmp. That is, your IDE sets the working directory to /tmp, not the beat.
To learn something about 'paths' check out this documentation (it's the same for all beats): https://www.elastic.co/guide/en/beats/filebeat/current/directory-layout.html
You can try to pass -path.home to the application arguments in your IDE. This should set all path variables to the correct path.

Visit Topic or reply to this email to respond.

In Reply To
caibaoying Panda
September 12
Thanks very much for answering my question. I created my own beats according to https://www.elastic.co/guide/en/beats/devguide/current/beater-interface.html#beater-interface but when i run it, there was a error: Exiting: error initializing publisher: Error loading template /tmp/axtx_beat.template.…

Visit Topic or reply to this email to respond.
To unsubscribe from these emails, click here.

This topic was automatically closed after 21 days. New replies are no longer allowed.