Custom fields in index pattern

Hi,

I'm fairly new to using Elastic/Kibana/APM and I'm trying to get custom fields to appear in the Kibana index pattern when the index comes from APM.

Using transaction.setCustomContext() I was able to add the fields I want to the transaction and those fields also show up in Kibana, but with a warning about a missing cached mapping.

I've tried adding a field to fields.yml in the APM folder and letting APM overwrite the existing one, but this did not seem to work.

How do I add my custom fields to Kibana so I can use searches on them and make graphs using those fields?

Hi Jeroen,

Thank you for your interest in ElasticAPM!

Custom context is meant to allow developers to supply rich additional context and potentially complex nested objects, but these values do not become searchable in Kibana.

For searchable fields, you'll want to set a tag instead:
https://www.elastic.co/guide/en/apm/agent/nodejs/current/agent-api.html#apm-set-tag

You shouldn't need to change anything related to index patterns, index mapping or the fields.yml

Hope that helps! And don't hesitate to shoot us any feedback you may have here or on GitHub.

1 Like

Setting a tag worked, thank you very much!
Although I used transaction.setTag() instead of apm.setTag(), that function not mentioned in the Transaction API, but does work. The same is true for transaction.setCustomContext()

Is there any way to insert multiple values at the same time as tags, or does each tag required its own function call? transaction.setCustomContext() was very useful to me because I could add a large amount of entries to it at the same time.

Currently you can only set one tag at a time with setTag(), but I don't see why we shouldn't support that. I'll take it up with the team :smiley:

1 Like

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