CSV2Syslog perl script

Hi Perl junkies :-)

Is there a way to parse a .csv file and convert the strings to syslog?
I want to take in a log file and forward the information to a syslog server.

Thanks!
cdukesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cdukesAuthor Commented:
I should mention that the csv files are on a windows box, so using logger is out :-(
0
Romi KuntsmanBig Data EngineerCommented:
Converting formats is always possible, and even easy with perl.

What fields are there in the csv file, and what format is the syslog file?

RK.
0
cdukesAuthor Commented:
I think the tricky part is going to be taking in text and pushing the data out to udp port 161

so let's say I  have a line of text:
03/28/2006,10:00:00,Authen OK,cisco,Engineering,10.1.1.2,tty130,20.1.1.1

These fields are as follows:
$DATE, $TIME, $MSG, $USER, $GROUP, $CALLERID, $NASPRT, $NASIP

So I need to read each line with these tokens and spit them out to a syslog server.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

ozoCommented:
$_="03/28/2006,10:00:00,Authen OK,cisco,Engineering,10.1.1.2,tty130,20.1.1.1";
my($DATE, $TIME, $MSG, $USER, $GROUP, $CALLERID, $NASPRT, $NASIP) = split/,/;
use Net::Syslog;
my $s=new Net::Syslog(Facility=>'local4',Priority=>'debug');
$s->send($_,Priority=>'info');
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cdukesAuthor Commented:
Nice!
Does this just log to the local syslog service? What if it's on winders?
0
cdukesAuthor Commented:
Also, how do I read the values from a .csv file instead of declaring $_ ?
0
ozoCommented:
while( <> ){
my($DATE, $TIME, $MSG, $USER, $GROUP, $CALLERID, $NASPRT, $NASIP) = split/,/;
...
}


Net::Syslog talks to any syslogd you can reach over the net.
You can set SyslogHost to the address of the remote syslogd    
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.