I tried it and, unfortunately, that just logs it to the PROGRAM field in syslog...
e.g.:
Jul 11 23:43:47 cdukes-lnx ecdcsrvr2-6.some.domain[85
Main Topics
Browse All TopicsI'm trying to write a syslog replayer and was wondering if there's a way to replace the originating hostname so that it logs that to syslog instead of my local machine's hostname.
For example, the logit sub below logs:
./logreplay.pl[8816]: Module 9 server state changed: SLB-NETMGT: TCP health probe re-activated server 10.13.164.13:0 in serverfarm ACC-FNET-AE\'
The original message is:
Jun 19 05:11:57 ecdcsrvr2-6.some.domain 5476: Jun 19 05:11:56: %CSM_SLB-6-RSERVERSTATE: Module 9 server state changed: SLB-NETMGT: TCP health probe re-activated server 10.13.164.13:0 in serverfarm 'ACC-FNET-AE'
So I want it to log the originating host as " ecdcsrvr2-6.some.domain"
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Pretty sure the syslogd daemon does a hostname look up which means you'd have to spoof your source IP. If your remote syslog'ing is done over UDP, spoofing the source IP isn't that difficult. There's an example (specific to syslog) in C here: http://insecure.org/sploit
If you want to keep it in perl, a generic example of UDP source IP spoofing is here: http://perl-code.blogspot.
Anyway... without hacking the syslogd source, pretty sure source IP spoofing is going to be your only option.
Business Accounts
Answer for Membership
by: clockwatcherPosted on 2009-07-11 at 19:30:47ID: 24833051
The first parameter to the openlog call is $ident and gets prepended to the log. You're passing it $0 which is the name of the running script. Try changing your openlog call to:
openlog(" ecdcsrvr2-6.some.domain", 'pid,cons', 'user');
And see if it gets you what you're after.