# Shortened Hostnames as variables

**URL:** <https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946>\
**Category:** Alerting\
**Tags:** dynatrace-managed, problems, infrastructure-operations\
**Created:** [October 31, 2025, 12:31am UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946 "2025-10-31T00:31:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![i\_g](https://avatars.discourse-cdn.com/v4/letter/i/82dd89/32.png) [@i\_g](https://community.dynatrace.com/u/i_g)\
**Post date:** [October 31, 2025, 12:31am UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946/1 "2025-10-31T00:31:05Z")

</div>

Hello all. Using advice from this post:  
[https://community.dynatrace.com/t5/Open-Q-A/Custom-Host-Names-Remove-FQDN/m-p/188561](https://community.dynatrace.com/post/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?

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 31, 2025, 1:13am UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946/2 "2025-10-31T01:13:57Z")

</div>

[@i\_g](https://community.dynatrace.com/user/73479)&nbsp;Can you please try the&nbsp;{dt.entity.host} parameter in the event template instead?

---

<div class="post-metadata">

**Author:** ![i\_g](https://avatars.discourse-cdn.com/v4/letter/i/82dd89/32.png) [@i\_g](https://community.dynatrace.com/u/i_g)\
**Post date:** [October 31, 2025, 1:23am UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946/3 "2025-10-31T01:23:58Z")

</div>

Hi mate. That just returned HOST-[identifierstring] 😞

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 31, 2025, 5:40am UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946/4 "2025-10-31T05:40:58Z")

</div>

[@i\_g](https://community.dynatrace.com/user/73479)&nbsp;Sorry, you are right, but interestingly when you look at the dt.event.title in the event details on the host&nbsp; it does show the updated name but this does not get passed on to the problem&nbsp;:grinning\_face\_with\_smiling\_eyes:

 ![p_devulapalli_0-1761889170577.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/f/1f280001755d7ff0bcab1aaa6f8ad72c4ed3166f.png)

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [October 31, 2025, 6:45pm UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946/5 "2025-10-31T18:45:34Z")

</div>

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&nbsp;transform {host.name} with a regex. You already send this example

---

<div class="post-metadata">

**Author:** ![i\_g](https://avatars.discourse-cdn.com/v4/letter/i/82dd89/32.png) [@i\_g](https://community.dynatrace.com/u/i_g)\
**Post date:** [December 1, 2025, 12:19am UTC](https://community.dynatrace.com/t/shortened-hostnames-as-variables/53946/6 "2025-12-01T00:19:25Z")

</div>

Hi mate. I missed this reply, apologies. Setting the host property using oneagentctl worked perfectly, I just gave it a test now. Thank you!
