31 Oct 2025
12:31 AM
- last edited on
31 Oct 2025
07:17 AM
by
MaciejNeumann
Hello all. Using advice from this post:
https://community.dynatrace.com/t5/Open-Q-A/Custom-Host-Names-Remove-FQDN/m-p/188561
I've shortened all of our hostnames down and it worked really quite well. However, my main driver for this was removing the FQDN from alerts that end up in ServiceNow, and that continues to occur.
I'm currently using {host.name} in the Event Template title in Events Extraction, but I'm noticing that {hostname} and {host.hostname} do not fill and remain as such in the Problem when it generates. Unsure if this is related.
Is there a way to get the shortened hostname into a variable for these fields please?
31 Oct 2025 01:13 AM
@i_g Can you please try the {dt.entity.host} parameter in the event template instead?
31 Oct 2025 01:23 AM
Hi mate. That just returned HOST-[identifierstring] 😞
31 Oct 2025 05:40 AM
@i_g Sorry, you are right, but interestingly when you look at the dt.event.title in the event details on the host it does show the updated name but this does not get passed on to the problem 😄
31 Oct 2025 06:45 PM
Hi,
you can try use custom metadata/kubernetes annotation.
I mean you have two option:
in Kubernetes: add an annotation to pod with the short name, e.g., short-hostname=web01 (on the node/pod—wherever you want to read it). Dynatrace ingests such metadata, so you can reference it in tags/naming rules
In Non-K8s hosts: set custom host metadata/tag via OneAgent, e.g.
oneagentctl --set-host-property ShortHostname=web01 (or a tag ShortHostname=web01).
Then use that metadata (e.g., {ShortHostname}) in your naming/template instead of {host.name}.
Second option is transform {host.name} with a regex. You already send this example