LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-14-2012, 03:03 PM   #1
LinuxLover!
LQ Newbie
 
Registered: Aug 2012
Location: Richmond, VA
Distribution: CentOS 6/Red Hat ES5.5
Posts: 8

Rep: Reputation: Disabled
Remote rsyslog using 'localhost' instead of name of the remote host


I am performing this in a text environment so there is no harm in messing anything up.

Objective: To have all the logs of the client server forwarded to the log server.

Client ip: 192.168.3.209
Client hostname:testsrv1

Log server ip: 192.168.3.210
Log server name: logsrv

I have testsr1 sending the logs to logsrv in the standard /var/log structure. However, when reading the logs on logsrv, the hostname "localhost" is appearing instead of testsrv1. I am guessing there is a config option somewhere but have looked on rsyslog.com and Google and can't find it.
 
Old 09-14-2012, 03:11 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
wtf would a text environment have any relation to messing things up??

Please provide your syslog.conf files, and samples of the logged data.
 
Old 09-15-2012, 07:51 AM   #3
LinuxLover!
LQ Newbie
 
Registered: Aug 2012
Location: Richmond, VA
Distribution: CentOS 6/Red Hat ES5.5
Posts: 8

Original Poster
Rep: Reputation: Disabled
My apologies. I meant to say test environment; not text.

Config for logsrv
Code:
# rsyslog v5 configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog   # provides kernel logging support (previously done by rklogd)
#$ModLoad immark  # provides --MARK-- message capability
#




# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf


#### RULES ####

# Custom rule from me
:fromhost-ip, isequal, "192.168.3.210" /var/rsyslog/test/test.log

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 *

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log


# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
$WorkDirectory /var/lib/rsyslog # where to place spool files
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList   # run asynchronously
$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ### end of the forwarding rule ###
Config for testsrv1
Code:
# rsyslog v5 configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog   # provides kernel logging support (previously done by rklogd)
#$ModLoad immark  # provides --MARK-- message capability

# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf


#### RULES ####


# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console
kern.warning						/var/log/iptables

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
#*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 *

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log


# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
$WorkDirectory /var/lib/rsyslog # where to place spool files
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList   # run asynchronously
$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
*.* @@192.168.3.210
 
Old 03-13-2014, 04:07 AM   #4
DenisM
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Rep: Reputation: Disabled
Question Have you solved your problem?

Have you solved your problem?
I faced the same one with RELP, not uxtcp.
 
Old 12-17-2017, 08:25 AM   #5
Iturbide
Member
 
Registered: Aug 2003
Location: The Hague, The Netherlands
Distribution: Mandrake 9something, Gentoo
Posts: 49

Rep: Reputation: 15
I just ran into this and it was an easy fix. I suspected rsyslog was looking up 127.0.0.1
So I went into /etc/hosts and put the hostname in, before localhost. So the line now reads:
127.0.0.1 myhostname localhost

Restart rsyslog, or reboot, and now myhostname is sent along to the syslog server.
 
Old 12-23-2019, 02:55 PM   #6
the_yeti
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by Iturbide View Post
I went into /etc/hosts and put the hostname in, before localhost. So the line now reads:
127.0.0.1 myhostname localhost

Restart rsyslog, or reboot, and now myhostname is sent along to the syslog server.
I tried that. No luck. What a strange and frustrating bug.

I'm seeing it with rsyslog-8.1911.0-1.fc31.x86_64 on Fedora 31. The only cure I found is to restart rsyslog after boot.

Last edited by the_yeti; 12-23-2019 at 02:57 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
OpenNMS remote poller configure on remote host moni Linux - Newbie 2 03-23-2012 06:11 AM
[SOLVED] syslog remote logging with rsyslog server Chenchu Linux - Newbie 3 09-17-2011 01:34 PM
Is it possible to gather remote host information without using remote agents? siavashgh Linux - Server 3 05-12-2011 03:57 AM
VSFTPD localhost-ok, remote host-cannot connect Giax Linux - Software 3 06-14-2004 06:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration