How to use IO::Socket with Log::Agent ad Log::Fork

W

writeson

Hi all,

A vender supplied a large Perl program that uses the Log::Agent module
to log a great deal of information to rotated files. Right now I have
a program that parses these log files periodically to change the state
of our systems based on what the Perl program is doing. This is
awkward and problematic for me, and I'd like to do something
different. What I'd like to do is have the Log::Agent module not only
log the messages to a file, but send them to a server (which I would
write) over the network using IO::Socket. This looks like it would
work as Log::Agent support IO::Handle and IO::Socket is derived from
that. However, that's about as far as I've gotten as I'm not a Perl
programmer at all, though I am a programmer. Can anyone help me out
and point me in the right direction to do this kind of thing? Any
guidance would be appreciated!

Thanks,
Doug
 
S

smallpond

Hi all,

A vender supplied a large Perl program that uses the Log::Agent module
to log a great deal of information to rotated files. Right now I have
a program that parses these log files periodically to change the state
of our systems based on what the Perl program is doing. This is
awkward and problematic for me, and I'd like to do something
different. What I'd like to do is have the Log::Agent module not only
log the messages to a file, but send them to a server (which I would
write) over the network using IO::Socket. This looks like it would
work as Log::Agent support IO::Handle and IO::Socket is derived from
that. However, that's about as far as I've gotten as I'm not a Perl
programmer at all, though I am a programmer. Can anyone help me out
and point me in the right direction to do this kind of thing? Any
guidance would be appreciated!

Thanks,
Doug


http://jobs.perl.org/
 
T

Ted Zlatanov

w> A vender supplied a large Perl program that uses the Log::Agent module
w> to log a great deal of information to rotated files. Right now I have
w> a program that parses these log files periodically to change the state
w> of our systems based on what the Perl program is doing. This is
w> awkward and problematic for me, and I'd like to do something
w> different. What I'd like to do is have the Log::Agent module not only
w> log the messages to a file, but send them to a server (which I would
w> write) over the network using IO::Socket. This looks like it would
w> work as Log::Agent support IO::Handle and IO::Socket is derived from
w> that. However, that's about as far as I've gotten as I'm not a Perl
w> programmer at all, though I am a programmer. Can anyone help me out
w> and point me in the right direction to do this kind of thing? Any
w> guidance would be appreciated!

1) find the places where the Log::Agent functions are used.
2) wrap those calls with your own log_custom() function
3) do whatever you need inside the log_custom() function

Sending arbitrary log data over the network can be slow, unreliable, and
difficult to implement. Consider using syslog's built-in log
aggregation features. Just writing out all log data to an open network
socket and hoping it will work, will not work.

Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top