Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

How to add a hostname in the syslog message sent to a syslog server.

0

0

Article ID: KB12679 KB Last Updated: 21 Jun 2019Version: 3.0
Summary:
By default, a hostname is not included in the header part of the syslog message. This article shows a method where a hostname can be added in the syslog packet, as some syslog utilities require it.
Symptoms:
Sample syslog configuration below will not include router's hostname in the header of the syslog message.
 
lab@m40e-re0> show configuration system syslog
host 200.100.1.1 {
     firewall any;
     interactive-commands any;
     facility-override local4;
}

Syslog packet output shows no hostname:
 
Nov 21 02:13:54 mgd[6543]: UI_CMDLINE_READ_LINE: User 'lab', command 'show interfaces terse '
Solution:
A workaround is to use log-prefix in the configuration and set it to whatever text you want to add. It can be a hostname or any other prefix required by the design.

lab@Penelope-re0> show configuration system syslog
host 200.100.1.1 {
     firewall any;
     interactive-commands any;
     facility-override local4;
     log-prefix M40e-Sydney;
}

 
Now syslog packet output contains hostname.
 
Message: Nov 21 01:41:28 M40e-Sydney: mgd[6543]: UI_CMDLINE_READ_LINE: User 'lab', command 'show interfaces terse '

 
Modification History:
2019-06-21: content reviewed for accuracy. Log-prefix link added.

Related Links

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search