Exported Fields: Name

Hello,
I noticed that the field 'name' is exported as 'type' if set.
E.g.

- name: some-name
  type: http
  urls:
    - www.myurl.com:123

results in a document like

{
...
"up": true,
"type": "some-name"
...
}

However, if no name is set, the type would be http.
I find this quite unintuitive - or is this by design?

BR

It's documented here: https://www.elastic.co/guide/en/beats/heartbeat/current/configuration-heartbeat-options.html#monitor-name

what's missing in the doc is, if name is not configured, the name setting defaults to the type-setting. That is name is optional (but should be used if multiple monitors of same time are configured).

You finding this unintuitive, how would you like it to work?

Hi Steffen,

I am aware of the documentation.
However, in my understanding it's a bit unintuitive that the name field overwrites the type.
I would expect a field name in the result set.
Furthermore, if I want to have the value of name and the type, I would have to parse the monitor field to extract the corresponding type again.

So imho:

Configuration

- name: myname
  type: http
  urls:
    - http://www.myurl.com:123
  ...

should result in

...
{
   "monitor": "$name@$type@$url",
   "name":  "myname",
   "type": "http",
   ...
}

rather than

...
{
   "monitor": "$type@$url",
   "type":  "myname",
   ...
}

BR

Thanks. I totally agree with your proposal. Can you open a github issue/enhancement request for heartbeat?

Sure, will do within the next few hours.
Thank you.

See issue

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