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

Posted on 2009-05-21
Medium Priority
Last Modified: 2012-08-14
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?
Question by:jl66
  • 3
  • 3
LVL 40

Assisted Solution

mrjoltcola earned 400 total points
ID: 24446424
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.

Author Comment

ID: 24450880
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.
LVL 39

Assisted Solution

Adam314 earned 1600 total points
ID: 24453040
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:
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 24453546
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?
LVL 39

Accepted Solution

Adam314 earned 1600 total points
ID: 24453822
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:

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

    Interface for dealing with syslog over a network

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

    Object-oriented version of Sys::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.
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


Author Comment

ID: 24454247
Nothing but appreciate it. Where can I check the messages and what commands can I use to get them?
LVL 39

Assisted Solution

Adam314 earned 1600 total points
ID: 24454837
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/

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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.

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question