Can a hostname be added to syslog-ng?

13,696

If you are sending from one syslog-ng server to another, just add the keep_hostname(yes) option.

If you are sending from syslog-ng to some other syslog daemon, you need to compile from source and use the enable source spoof option.

If you just want names instead of IPs, then try use_dns(yes).

Here's a short video on configuring syslog-ng.

Share:
13,696

Related videos on Youtube

Ed Gl
Author by

Ed Gl

Updated on September 18, 2022

Comments

  • Ed Gl
    Ed Gl over 1 year

    How can syslog-ng be configured to send both the hostname and the IP address. Currently, logs are sent with the IP address of the device/machine, but we want to add the hostname so I could keep my ip management database up to date with the correct hostname (no, I don't use DHCP :))

  • Ladadadada
    Ladadadada almost 12 years
    Note that use_dns(yes) requires reverse DNS lookups from the central syslog-ng server on the source server's IP address to work.
  • Clayton Dukes
    Clayton Dukes almost 12 years
    To add to what Ladadadadada (or something, heh) said, if you have use_dns and no dns available, it will use your /etc/hosts first - assuming you have files, dns set in your nsswitch.conf.
  • Ed Gl
    Ed Gl almost 12 years
    options 1 and 2 is the way to go... thanks!
  • deFreitas
    deFreitas almost 6 years
    I need to know where put keep_hostname
  • deFreitas
    deFreitas almost 6 years
    ok here an example /etc/syslog-ng/syslog-ng.conf options {keep_hostname(yes);}; source... it is really hard to find out when you are a newbie
  • Clayton Dukes
    Clayton Dukes almost 6 years
    That's not a good thing to do if you ever start using a more advanced tool like LogZilla. Instead, put that ip in a metatag with the message, like host_ip="10.72.13.130" $MSG