cdukes
asked on
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!
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!
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.
What fields are there in the csv file, and what format is the syslog file?
RK.
ASKER
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.
so let's say I have a line of text:
03/28/2006,10:00:00,Authen
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.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Nice!
Does this just log to the local syslog service? What if it's on winders?
Does this just log to the local syslog service? What if it's on winders?
ASKER
Also, how do I read the values from a .csv file instead of declaring $_ ?
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
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
ASKER