-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Zak,

Good morning.
Thanks for the help and information. I will try this.


regards,
kenneth

On Wednesday, 28 September, 2011 02:48 PM, Zak Elep wrote:
> On Wednesday, September 28, 2011, Kenneth P. Oncinian wrote:
> 
>> I found the following perl script in the web that logs data from
>> a serial port to a log file. I tested it on a PBX and it worked
>> Ok - logging the the SMDR data to a log file. Can this script be
>> extended so that it inserts the data to a MySQL table instead of
>> using a log file? Or better yet using both log file and MySQL.
>> 
>> 
> Sure, you'll probably need something like Log::Dispatch[0]  using a
> DBI[1] backend along with regular logfile.
> 
> [0]:  http://metacpan.org/module/Log::Dispatch [1]:
> http://metacpan.org/module/Log::Dispatch::DBI
> 
> In the script below, you can do something like this, before
> creating the Device::SerialPort object:
> 
> ,---- | use Log::Dispatch; | | my $log = Log::Dispatch->new( |
> outputs => [ |     ['File', min_level => 'debug', filename =>
> '/path/to/logfile'], |     [ 'DBI', |       min_level  => 'info', |
> datasource => 'dbi:mysql:log', |       username   => 'logger', |
> password   => 'lumberjack', |       table      => 'logging' |
> ] |   ] | ); `----
> 
> Then later on, if you want to log, just do the following, instead
> of `print LOG $sStr':
> 
> ,---- | $log->info($sStr); `----
> 
> Of course, you have to create the MYSQL database prior; see the
> perldoc for Log::Dispatch::DBI for more information.
> 
> 
> 
> 
> 
> _________________________________________________ Philippine Linux
> Users' Group (PLUG) Mailing List 
> http://lists.linux.org.ph/mailman/listinfo/plug Searchable
> Archives: http://archives.free.net.ph

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOhQOZAAoJENQ/v+Lg/51DLdMIAKxGiRlnEc0GPOHm7x32cTnt
lWxj+1WDfFVAbwqFZiLyYMZ9Wyx/BpFoGV6y9m/Y4y0k4D9tNxW4zzCYOko4pLN6
OxYXtXte4o2ZU9+IBoHYIdoG/GBOQkku13DLWbqivF6LTNqoHmV3kXJKFr4oEsvO
n7xt4n+yaVnBd//Q0sBnXrXIOFEpupfJAccbuPKM5GX56jbliu3P4MjGqdUmQOCK
EWX7l/Y7LdKSmMSzyp0gcCGQCDcJAQxKUzUc8limMxyT/jfVCnGksdswUNSRNFA4
xUe5GUaDI3UmuppHLa1L6xDCGdyDwxAgHUWziKjgCkL76KYXaapY7dLG+GbnNGA=
=80If
-----END PGP SIGNATURE-----

Attachment: 0xE0FF9D43.asc
Description: application/pgp-keys

_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to