Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am currently filtering logs to a CentOS 6.3 syslog-ng server. Below is my basic syslog-ng config.

options {
        use_fqdn(yes);
        use_dns(yes);
        dns_cache_hosts(/etc/hosts);
        dns_cache(yes);
        keep_hostname(yes);
        long_hostnames(off);
        log_fifo_size(1024);
};

Most of the servers coming in are working correctly. I see computername.domainname.com. However, there are a few that are not working correctly. One example is a Cisco switch. It is 192.168.1.1 and continues to create a folder of 192.168.1.1. I can do a nslookup of the IP on the syslog-ng box and it shows the correct domain name. I can also do a tcpdump for the domain name and it show up correctly. So I then tried adding the entry in /etc/hosts to force it to use the domain name and still haven't had any luck. It continues to come across as the IP address.

There is 1 more weird issue that I'm having with a few other servers. Sometimes the logs go into a /logs/computer_name folder and other times it goes into /logs/computer_name.domain_name.com folder. It seems to be confused on what the true DNS name is.

Anyone have any recommendations on what to try?

Thanks, Eric

share|improve this question
    
could you please post your nsswitch.conf? or are you using two dns servers and in one the reverse lookup of the ip isn't enabled or the IP isn't configured correctly there? –  Hartmut Apr 26 '13 at 14:16
    
@Hartmut - My nssiwtch.conf has this line in it - "hosts: files dns". I am currently using 3 DNS servers. I confirmed that all of them are able to nslookup the IP correctly. –  Eric Apr 26 '13 at 14:29
    
The keep_hostname(yes) keeps the name in the packages you receive from the cisco switch. Could it be that the cisco Switch just sends the IP in the package? I guess because of the keep_hostname option the lookup of the dns name is omitted and syslog-ng just thinks it already has the hostname, although it is just the IP. –  Hartmut Apr 26 '13 at 19:07
    
@Hartmut - That appears to be exactly what is happening. I just thought I would be able to override that with the /etc/hosts file in the event that occurs. –  Eric Apr 26 '13 at 19:28
2  
I think then you need to deactivate the keep_hostname option. As far as I understood it, it overrides all the other names options. –  Hartmut Apr 26 '13 at 19:30
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.