How to link Kibana URL for log in Alert?

I have an alert where I am sending certain data from log in alert which is working as expected. What I want to do is, I also want to include URL in alert but not sure about one particular id.


Here is my way to create URL,{{ ctx.results.0.hits.hits.0._index }}/_doc?id={{ ctx.results.0.hits.hits.0._id }}

Is there a way I can get NOT-SURE-WHERE-TO-GET-THIS from ctx?

1 Like

Unfortunately it won't be available in ctx. It's the index pattern id saved in the .kibana index. It is fixed to the kibana index pattern that's being searched over, so if the alert is fixed to a known index pattern you could grab that id. You can see it in the URL in the discover page.

A hacky workaround that may or may not have performance impacts is to create an index pattern in kibana that matches all indices (*) and use that id.


I can't say I'd recommend it, it may produce some unnecessarily large queries when setting up but could be considered as an alternative

In that case, what is the best practice you would recommend to pull the log for unique id and create URL?

Can I create search where I can update this unique id based on alert?

i.e. https://SOME-URL/ID/{{ctx.results.0.hits.hits.0._id}}

1 Like

When you say index pattern id is saved, do you mean it will be always same? i.e. same for day, month Vs always same.

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