how to use win32::EventLog: perl module on linux server?

Would like to use the perl module win32::EventLog on the linux box. I got the error message:
----
Can't locate Win32/EventLog.pm
----
How to get it or how to load it?
jl66Asked:
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.

mrjoltcolaCommented:
Linux is not a supported platform. Win32 modules are modules exposing/wrapping WIn32 apis for Windows environments, which Linux is not.

Sounds like the script was written for Windows. On Linux you could use a syslog module.
0
jl66Author Commented:
Thanks for updates. Actually the script was for AIX originally for windows. Do you have an example how to use syslog module? Thanks in advance.
0
Adam314Commented:
There are several perl modules to interface with syslog.  Which you use will depend on your preference.  Read through a few of these, then post back here if you have questions:
http://search.cpan.org/search?query=syslog&mode=module
0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

jl66Author Commented:
Thanks for updates. I checked the link, but I am still not sure which one I should choose. I guess it is Logger:Syslog. Let me tell you what is needed. In my perl application, I just want to log some messages: error, warning, and info. Could you help choose one and better give me an example for it or point to a link for the example?
0
Adam314Commented:
You have a choice in what module you use.  Different modules provide a different interface, and different amounts of functionality.  Here is a quick summary of a few:

Logger::Syslog
    Simple interface to work with the syslog on the local machine (eg: not over a network).

Net::Syslog
    Interface for dealing with syslog over a network

Sys::Syslog
    More feature-rich interface to syslog, with a more complicated interface

Sys::Syslog::OO
    Object-oriented version of Sys::Syslog

Tie::Syslog
    Tie a file handle to syslog.  You could even tie STDERR, so your program STDERR goes to syslog.

There are several others, but these are the most popular.  For what it sounds like you want, the Logger::Syslog sounds like it would be best.  Better examples are on the CPAN page for that module, but here is a quick example.  There will be 1 function for each of the different types of log levels.  Call the appropriate function with the message you want to log.
#!/usr/bin/perl
use strict;
use warnings;
use Logger::Syslog;
 
#Log a message to error
error('Some error occurred');
 
#Log a message to warning
warning('Some warning occurred');
 
#Log a message to info
info('Some info here');

Open in new window

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
jl66Author Commented:
Nothing but appreciate it. Where can I check the messages and what commands can I use to get them?
0
Adam314Commented:
Exactly where your logs go will depend on your configuration.  The configuration is usually /etc/syslog.conf.  You can view that file to see your configuration, and get the details on the format/meaning of the configuration of this file with:
    man syslog.conf
You can have different messages got to different places based on the facility (program) or type (info, warning, error, ...).

The typical place for most messages is /var/log/messages.  It is a plain text file, so you can view it any way you'd view a test file.  There are also graphical syslog viewers that make it easier to view.
  gnome-system-log:  http://library.gnome.org/users/gnome-system-log/2.26/
  KSystemLog:  http://ksystemlog.forum-software.org/
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.