# forceLocalHostname

Forces the message `HOSTNAME` to the rsyslog `localHostName` value.

This parameter applies to mmtaghostname: message modification module.

Name:

  forceLocalHostname

Scope:

  input

Type:

  boolean

Default:

  off

Required?:

  no

Introduced:

  at least 7.0, possibly earlier

## Description

When enabled, this parameter forces the message’s `HOSTNAME` field to the rsyslog value `localHostName`. This is useful for setting a consistent hostname on messages that may not have one, e.g. those received via `imudp` or `imtcp`. A common use case is with applications in auto-scaling environments (e.g. AWS), where instances may have ephemeral hostnames. Forcing the hostname to the rsyslog host’s name can provide more meaningful and consistent hostnames in logs.

## Input usage

    action(type="mmtaghostname"
           forceLocalHostname="on")

## Notes

- Legacy documentation referred to the type as `Binary`; it is treated as boolean.

## See also

- mmtaghostname: message modification module

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.