Skip to content

With the parameter $PreserveFQDN on the logged-in host is not the full host(FQDN) #1740

@Roarca

Description

@Roarca

Description

When on the client side you activate the $PreserveFQDN property on /etc/rsyslog.conf , the logs do not include the FQDN and only include the host

Configuration

My rsyslog.conf configuration (everything is default except the parameter)

$PreserveFQDN on

The /etc/hosts file

127.0.0.1 host.app.example host

And the log4j2 configuration

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
	<Appenders>
		<Console name="LogToConsole" target="SYSTEM_OUT">
			<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
		</Console>
		<Syslog name="RFC5424" format="RFC5424" host="localhost" port="514" protocol="TCP" appName="app" includeMDC="true" facility="LOCAL0" enterpriseNumber="18060" newLine="true" messageId="app-ID" mdcId="mdc" id="app-MDCID" connectTimeoutMillis="1000" immediateFail="true" reconnectionDelayMillis="5000">
			<LoggerFields>
				<KeyValuePair key="thread" value="%t" />
				<KeyValuePair key="priority" value="%p" />
				<KeyValuePair key="category" value="%c" />
				<KeyValuePair key="exception" value="%ex" />
				<KeyValuePair key="message" value="%m" />
			</LoggerFields>
		</Syslog>
	</Appenders>
	<category name="org.springframework.beans">
		<priority value="info" />
	</category>
	<Loggers>
		<Logger name="foo.example.ErrorService" additivity="false">
			<AppenderRef ref="RFC5424" />
			<AppenderRef ref="LogToConsole" />
		</Logger>
	</Loggers>
</Configuration>

Version: [Log4j version]

2.17.0

Operating system: [OS and version]

SUSE Linux Enterprise Server 12 SP3

JDK: [JDK distribution and version]

OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

Logs

2023-08-24 14:01:49.569 host app[4539] [status] Starting...

Reproduction

Activating the $PreserveFQDN on parameter and having in /etc/hosts an FQDN longer than the normal host should be enough, but ask any questions you may have

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect, unexpected, or unintended behavior of existing codelayoutsAffects one or more Layout pluginsruntimeSpecific to the runtime environment

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions