Sponsored Content
Top Forums Shell Programming and Scripting Perl script to parse multiple windows event logs. Post 302741283 by spacebar on Friday 7th of December 2012 09:34:35 PM
Old 12-07-2012
Try it like this:
Code:
use Win32::EventLog;

my @log_type            =  ( "Application", "Security", "Setup", "System", "Forwarded Events" );
my $log_type;
my $elh;
my $events_count        =  0;
my $total_events_count  =  0;


foreach $log_type ( @log_type ) {
  $elh  =  Win32::EventLog->new(  $log_type ) or die "Can't open $log_type Event Log\n";
  $elh->GetNumber( $events_count );
  $total_events_count  =  $total_events_count + $events_count;
}
print $total_events_count;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script to rotate logs

I have a shell script that will gzip/tar/archive application logs that are over 20 days old which works just fine, but I would like to convert to a Perl script. Problem is, I'm a beginner with Perl and all attempts so far have failed. Basicaly I have a log dir /app/logs that contains several... (18 Replies)
Discussion started by: theninja
18 Replies

2. Solaris

ILOM event logs

Hello I have a server Sun Fire X4250. Few days ago I take a look to ILOM -> System Monitoring -> log events. I saw some lines that I don't understand, for example: 5800 Chassis Action major Oct 30 23:58:35 2009 Hot insertion of /SYS/DBP/HDD12 5799 Chassis ... (3 Replies)
Discussion started by: marimontes
3 Replies

3. Shell Programming and Scripting

Perl script to parse all files in the folder

Hello Smart People! I have a perl script that will import xml data into an access db. I would like to modify it so it will automatcially parse through all xml files in the folder. I swa a post but couldnt get it working. her is what my scrip looks like, i only list the top if you need more... (3 Replies)
Discussion started by: cowboymaverick
3 Replies

4. Shell Programming and Scripting

Combine multiple unique lines from event log text file into one line, use PERL or AWK?

I can't decide if I should use AWK or PERL after pouring over these forums for hours today I decided I'd post something and see if I couldn't get some advice. I've got a text file full of hundreds of events in this format: Record Number : 1 Records in Seq : ... (3 Replies)
Discussion started by: Mayday22
3 Replies

5. Shell Programming and Scripting

sed script to parse logs issue

I have this script to parse some logs: #!/bin/bash id=$1 shift sed "/(id=$id)/,/^$/!d" "$@" Usage: ./script.sh 1234 logfile The logs have an empty line before the logged events/timestamps -- most of the time. And this is my issue, since when there is no empty line, it will catch things... (4 Replies)
Discussion started by: KidCactus
4 Replies

6. Shell Programming and Scripting

Unable to get full message text from Windows Event Logs

Hi all, . I am developing a log monitoring solution in perl for Windows I am using the CPAN module Win32 ::EventLog (0.076) version for getting the events from windows. The problem which I am facing now is all the Windows 2008 machines are upgraded with Service pack2 from then I couldn’t able... (2 Replies)
Discussion started by: kar_333
2 Replies

7. Shell Programming and Scripting

Perl script to extract last 24 hrs logs from cronlog

Hi Friends, Can anybody help me to create a perl script to generate log file for last 24 hrs from cron log file ?? Thank You (2 Replies)
Discussion started by: syamji.vm
2 Replies

8. Shell Programming and Scripting

Shell Script for viewing multiple logs from multiple server

I am new to Shell scripting and below is my requirement. I need to search some specific word e.g. "exception" or "transaction" from log file. We have multiple env e.g. Level1 , Level2 etc and each env have Multiple boxes e.g. For Level 1 env we have "test11.test.com" , "test12.test.com". Each... (1 Reply)
Discussion started by: peeyush
1 Replies

9. Shell Programming and Scripting

Bash Script to parse Perforce Logs

Hi All, I need to write a bash script that will parse some perforce log files, the log files will contain user login information, the script would need to pare the log, and check who logs in, and if the user is a superadmin, then the script will check the ip address to see which server the... (4 Replies)
Discussion started by: BostonRob
4 Replies

10. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
dhcpclient(1M)															    dhcpclient(1M)

NAME
dhcpclient - Client for Dynamic Host Configuration Protocol Server SYNOPSIS
hostname] tracefile] class-id] debug_level] server_ipaddress] log_type] send_attempts] time_to_wait] interface server_ipaddress] hostname] tracefile] debug_level] interface server_ipaddress] log_type] time_to_wait] tracefile] debug_level] interface server_ipaddress] log_type] DESCRIPTION
is used to obtain the configuration parameters from the Dynamic Host Configuration Protocol server (bootpd(1M)) to configure the host. Currently, supports 10bt(10BaseT) and 100bt(100BaseT) networks only. It does not support networks. is invoked by the script (see auto_parms(1M)) at boot up. The file is used for the configuration of the interfaces. To invoke using the script, set the variable to a non-zero value in the file. can also be invoked at the command prompt, when the interface is not configured. Once the obtains the configuration parameters from the server, it is stored in a configuration file named The configuration parameters are valid for a fixed time, lease time. The configuration information in file will be of the following format. The length field denotes the length of the data field following it. All these lines collectively indicate one record. The configuration file will have series of records. Since this file contains all the configuration information, it can be used to identify the server from which the configuration parameters were obtained. The configuration file can also be used to obtain the same configuration parameters from the server. So, once the is invoked, it will try to read the configuration file, While trying to read the file, the following conditions are possible: 1. It may be possible that the configuration file had been deleted or it may not be available for reading. 2. The file may have got corrupted and contains irrelevant data for the particular interface. 3. There may be no configuration information for the particular interface. 4. User may have specified option meaning that a new lease is needed. For all of the above cases, has to first find the server which is ready for the service. For this purpose, it will send a message. If the user has specified server_ipaddress using the option, then replies only from the specified server will be accepted. The server in turn will reply with the configuration parameters that it can offer. This message is called If the client has sent the to broadcast address, then it will receive from more than one server. The selects one of the obtained. Then, it will send to the server, requesting the configu- ration parameters. The server will reply with a positive acknowledgement called if it is willing to send the configuration parameters to the host and with a negative acknowledgement, if it is not willing to do so. If the has received it will copy all the configuration parame- ters to the configuration file, else, it will send another message and repeat the whole process. This process is called "Obtaining a new lease". If all the above 4 cases are not true, then the can directly send the message and obtain the configuration parameters as mentioned above. This process is called "Renewing the lease". The various options supported by are as described below. Options When this option is used, the client will accept the reply from the server only if the in the request and reply packet matches. This option is used to send a hostname. The hostname should be specified as an ASCII string. This option is used during bootup time to obtain a new lease. If the client is trying to obtain the configuration parameters from the server for the first time, then does not exist. So, using this option, the client obtains a new lease for the interface specified. This option is used for dumping the internal data of an interface. A sample dump is shown below. This option is used to specify the file name for the debugging output. This option is used for specifying the of the device group. should be specified as an ASCII string. This option is used for logging of debug information. debug_level specifies the amount of debug information logged. The debugging messages are sent to This option is used for maintaining the lease. When invoked with this option, the runs as a daemon. The calculates how much time it needs to sleep before the lease needs to be renewed and then sleeps for that time. When it wakes up, it extends the lease by sending the request to the server. This option is used for ignoring the current lease. When this option is used, the current configuration information is discarded and request for a new lease is sent. This option is used for tracing the packets. It displays the packet contents in a readable format. This option is used for releasing a lease. The releases all the assigned configuration parameters. This is done by sending the message to the server. The dhcpclient then empties the record corresponding to that interface in the configuration file, This option is used to specify the ip address of the server from which the reply should be accepted. server_ipaddress must be a unicast IP address specified in dotted decimal form. If the log_type is a non zero value and if the debug_level is low enough for the process to detach from the tty (see syslog(3C)), then, the logging goes to else it goes to This option is used when the is running as a daemon. This option prints the various version strings of the to stdout. This option is used to specify the number of attempts the packet should be sent before obtaining a reply. send_attempts must be specified as an unsigned number. This option is used to specify the time interval between successive packet retransmission. time_to_wait will be in seconds. EXAMPLES
To the lease for the interface lan0 and invoke logging in the following set of commands is invoked at the command prompt: To trace the packet and get the debugging messages, use: This is an example of a file. 00 4 lan0 01 5 dhcph 02 0 03 0 04 0 05 0 06 4 4294967295 07 4 4294967295 08 4 0 09 4 0 10 4 1 11 6 8 0 9 25 a5 b1 12 4 192.11.22.107 13 4 255.255.255.0 14 4 0.0.0.0 15 0 16 4 192.11.22.3 17 4 192.11.22.3 18 0 19 0 20 0 21 4 0.0.0.0 22 0 23 0 24 39 63 82 53 63 35 1 5 33 4 ff ff ff ff 36 4 c0 b8 16 3 1 4 ff ff ff 0 c 5 64 68 63 70 68 2 4 ff ff b2 a8 ff AUTHOR
was developed by HP. FILES
configuration file. SEE ALSO
auto_parms(1M), bootpd(1M), bootpquery(1M), dhcptools(1M), syslog(3C). DARPA Internet Request For Comments: RFC1541, RFC1542, RFC1533, RFC1534, Assigned Numbers RFC. dhcpclient(1M)
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy