LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 11-24-2015, 05:59 AM   #1
sstavdal
LQ Newbie
 
Registered: Jul 2010
Posts: 8

Rep: Reputation: 0
rsyslog parse syslog message and manipulate contents


Hello,

I have some devices that send syslog messages to an rsyslog server.
The syslog datagram is composed of a few headers, including syslog type, severity, mnemonic in addition to the syslog message.

The syslog message contains the senders ip address (not hostname), and there is no way to reconfigure the device to send hostname instead of ip address.

Example of syslog message content :
Nov 24 12:53:24 10.10.10.10 00076 ports: port 3 is now on-line

I would like rsyslog to parse out the IP, do a dns lookup and replace with the dns name before the log is written to file.

Desired output :
Nov 24 12:53:24 <hostname_from_dnslookup> 00076 ports: port 3 is now on-line

Has anyone done such a thing before, any tips/hints that can help me resolve this?

rsyslog is a must, as it is used for all our logging, so is the desire to resolve before it is written to file as it is being ingested by another tool that needs hostnames rather than ip.

Your help is much appreciated,

Thanks,
Simon.
 
Old 11-24-2015, 07:04 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Simon:

http://serverfault.com/questions/274...short-hostname
offers tips, eg: $LocalHostName yourhostname, modification of /etc/hosts...

Seems apparent that (r)syslog uses gethostbyname (hostname) and that comes from
Code:
hostname
of the sending box.
What is the hostname of the sending boxes?
Are they named by name or IP?

You may wish to search rsyslog documentation for 'Property Replacer' to replace directly on syslog receiver.
It will surely require a template if the $LocalHostName yourhostname doesn't do it directly, or if the hostname can't be changed.

References:
http://www.gossamer-threads.com/list...log/users/3487

Last edited by Habitual; 11-24-2015 at 08:43 AM.
 
  


Reply

Tags
dns, hostname, parse, rsyslog



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
use rsyslog to write to a remote syslog jmad43@jhu.edu LinuxQuestions.org Member Success Stories 0 11-15-2013 10:41 AM
sysklogd, rsyslog or syslog-ng bartgymnast Slackware 1 09-10-2013 11:11 AM
rsyslog filtering syslog messages sanjose Linux - Newbie 13 11-07-2012 03:08 PM
[SOLVED] I can send syslog log to rsyslog server? how? JohnV2 Linux - Server 6 10-13-2011 08:55 AM
[SOLVED] syslog remote logging with rsyslog server Chenchu Linux - Newbie 3 09-17-2011 01:34 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 12:56 PM.

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