Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

logwatch script comments

 
   Database Forums (Home) -> Sybase RSS
Next:  EXEC (select... ) problem Help!  
Author Message
julien Touche

External


Since: Oct 23, 2004
Posts: 6



(Msg. 1) Posted: Sat Aug 06, 2005 12:55 pm
Post subject: logwatch script comments
Archived from groups: comp>databases>sybase (more info?)

Hello

i would like to ask for comments about the following script for logwatch
about ASE, Mon, Hist, Backup and replication server.

test with logwatch 5.5 on Centos4/Linux
(4 script + conf and one shared script modified)

thanks
regards

julien

=== /etc/log.d/scripts/shared/applystddate
#!/usr/bin/perl -w
##########################################################################
# $Id: applystddate,v 1.12 2002/10/14 16:21:57 kirk Exp $
##########################################################################

########################################################
# This was written and is maintained by:
# Kirk Bauer
#
# Please send all comments, suggestions, bug reports,
# etc, to kirk.TakeThisOut@kaybee.org.
########################################################

use POSIX qw(strftime);

# This will pick out only the wanted date from a logfile
# in the standard /var/log/messages format.

# I plan to add a *lot* more date flexibility at a later time...

my $time = time;
my ($SearchDate,$SearchDate2);

if ( defined($ENV{'LOGWATCH_DATE_RANGE'}) && $ENV{'LOGWATCH_DATE_RANGE'}
eq 'yesterday') {
$SearchDate = strftime("%b %d", localtime($time-86400));
$SearchDate2 = strftime("%Y/%m/%d", localtime($time-86400));
}
elsif ( defined($ENV{'LOGWATCH_DATE_RANGE'}) &&
$ENV{'LOGWATCH_DATE_RANGE'} eq 'today') {
$SearchDate = strftime("%b %d", localtime($time));
$SearchDate2 = strftime("%Y/%m/%d", localtime($time));
}
elsif ( defined($ENV{'LOGWATCH_DATE_RANGE'}) &&
$ENV{'LOGWATCH_DATE_RANGE'} eq 'all') {
$SearchDate = "... ..";
$SearchDate2 = "..../../..";
} else {
print "no ENV{'LOGWATCH_DATE_RANGE'}\n";
exit 1;
}

# The date might be "Dec 09", but it needs to be "Dec 9"...
$SearchDate =~ s/ 0/ /;

if ( defined($ENV{'LOGWATCH_DEBUG'}) && $ENV{'LOGWATCH_DEBUG'} > 5 ) {
print STDERR "DEBUG: Inside ApplyStdDate...\n";
print STDERR "DEBUG: Range: " . $ENV{'LOGWATCH_DATE_RANGE'} . "\n";
print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
}

while (defined($ThisLine = <STDIN>)) {
if ($ThisLine =~ m/^$SearchDate ..:..:.. [^ ]* [^
]*\[[0123456789]*\]: /o) {
print $ThisLine;
} elsif ($ThisLine =~ m/^$SearchDate ..:..:.. [^ ]* [^ ]*: /o) {
print $ThisLine;
} elsif ($ThisLine =~ m/(Mon|Tue|Wed|Thu|Fri|Sat|Sun) $SearchDate
...:..:.. \d{4}/o) {
print $ThisLine;
} elsif ($ThisLine =~ m/^$SearchDate ..:..:.. ..../o) {
# add year at the end / sybase Monitor & Historical Server
print $ThisLine;
} elsif ($ThisLine =~ m/^[IWE]. $SearchDate2 ..:..:..\./o) {
# sybase replication server: "I. 2005/06/27 20:09:35. "
print $ThisLine;
} elsif ($ThisLine =~ m/^[0-9:]{14}:$SearchDate2 ..:..:../o) {
# sybase ASE: "00:00000:00000:2005/06/27 19:52:45.91"
print $ThisLine;
} else {
# no date on this line
#print $ThisLine;
}
}

=== /etc/log.d/conf/services/sybase.conf
Title = "Sybase ASE"
LogFile = sybase
=== /etc/log.d/conf/services/sybase_back.conf
Title = "Sybase Backup Server"
LogFile = sybase_back
=== /etc/log.d/conf/services/sybase_mon.conf
Title = "Sybase Monitor & Historical Server"
LogFile = sybase_mon
=== /etc/log.d/conf/services/sybase_rs.conf
Title = "Sybase Replication Server"
LogFile = sybase_rs
=== /etc/log.d/conf/logfiles/sybase.conf
# as there is no easy way to distinguish ASE log, monitor server, backup
# server, and RS, put symlink
# sybase$ mkdir -p $SYBASE/log/{ase,mon,back,rs}
#LogFile = /export/sybase/ASE-*/install/*.log
Logfile = /export/sybase/log/ase/*.log

## need custom script
*ApplyStdDate =

=== /etc/log.d/conf/logfiles/sybase_back.conf
#LogFile = /export/sybase/ASE-*/install/*.log
Logfile = /export/sybase/log/back/*.log
*ApplyStdDate =

=== /etc/log.d/conf/logfiles/sybase_mon.conf
#LogFile = /export/sybase/ASE-*/install/*.log
Logfile = /export/sybase/log/mon/*.log
*ApplyStdDate =

=== /etc/log.d/conf/logfiles/sybase_rs.conf
#LogFile = /export/sybase/ASE-*/install/*.log
Logfile = /export/sybase/log/rs/*.log
*ApplyStdDate =

=== /etc/log.d/scripts/services/sybase
#!/usr/bin/perl -w
##########################################################################
# $Id: Sybase ASE $
##########################################################################

use Logwatch ':all';

$Debug = ValueOrDefault($ENV{'LOGWATCH_DEBUG'}, 0);
$Detail = ValueOrDefault($ENV{'LOGWATCH_DETAIL_LEVEL'}, 0);
$Service = "Sybase ASE";

# Avoid "Use of uninitialized value" warning messages.
sub ValueOrDefault {
my ($value, $default) = @_;
return ($value ? $value : $default);
}

# No sense in running if sybase doesn't even exist on this system...
#unless (( -f "$ENV{'SYBASE'}/ASE-12-5/bin/dataserver" ) {
# exit (0);
#}

if ( $Debug >= 5 ) {
print STDERR "\n\nDEBUG: Inside Sybase Filter \n\n";
$DebugCounter = 1;
}

while (defined($ThisLine = <STDIN>)) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG($DebugCounter): $ThisLine";
$DebugCounter++;
}
chomp($ThisLine);
if (
($ThisLine =~ m/server\s+Started Rep Agent on database/) or
($ThisLine =~ m/server\s+Shutting down Rep Agent (on|for)
database/) or
($ThisLine =~ m/server\s+Memory allocated for the tempdbcache
cachelet/) or
($ThisLine =~ m/server\s+Database '.*' is now online/) or
($ThisLine =~ m/server\s+Recovering database '.*'./) or
($ThisLine =~ m/server\s+Checking external objects./) or
($ThisLine =~ m/server\s+The transaction log in the database
'.*' will use I\/O size of/) or
($ThisLine =~ m/kernel\s+Virtual device .* started using/) or
($ThisLine =~ m/kernel\s+Detected [0-9]+ physical CPU/) or
($ThisLine =~ m/server\s+Activating disk '.*' of size [0-9]+
bytes./) or
($ThisLine =~ m/server\s+Activating disk '.*' of size [0-9]+
KB./) or
($ThisLine =~ m/kernel\s+Initializing virtual device/) or
($ThisLine =~ m/kernel\s+Use license file/) or
($ThisLine =~ m/kernel\s+Adaptive Server Enterprise\//) or
($ThisLine =~ m/kernel\s+Adaptive Server Enterprise Edition/) or
($ThisLine =~ m/kernel\s+Sybase, Inc. 5000 Hacienda Drive,
Dublin, CA 94568, USA/) or
($ThisLine =~ m/kernel\s+Logging ASE messages in file/) or
($ThisLine =~ m/Copyright/) or
($ThisLine =~ m/Sybase, Inc. All rights reserved./) or
($ThisLine =~ m/Confidential property of Sybase, Inc.$/) or
($ThisLine =~ m/Unpublished rights reserved under U.S. copyright
laws./) or
($ThisLine =~ m/This software contains confidential and trade
secret information of Sybase,/) or
($ThisLine =~ m/Inc. Use, duplication or disclosure of the
software and documentation by/) or
($ThisLine =~ m/the U.S. Government is subject to
restrictions set forth in a license/) or
($ThisLine =~ m/agreement between the Government and
Sybase, Inc. or other written/) or
($ThisLine =~ m/agreement specifying the Government's rights
to use the software and any/) or
($ThisLine =~ m/applicable FAR provisions, for example, FAR
52.227-19./) or
($ThisLine =~ m/Sybase, Inc. One Sybase Drive, Dublin, CA 94568,
USA/) or
($ThisLine =~ m/server\s+SQL Server's default unicode sort order
is '.*'./) or
($ThisLine =~ m/server\s+SQL Server's default sort order is:/) or
($ThisLine =~ m/server\s+on top of default character set:/) or
($ThisLine =~ m/server\s+Started ANALYSIS pass for database
'.*'./) or
($ThisLine =~ m/server\s+Completed ANALYSIS pass for database
'.*'./) or
($ThisLine =~ m/server\s+Started REDO pass for database '.*'.
The total number of log records to process is [0-9]+./) or
($ThisLine =~ m/server\s+Completed REDO pass for database '.*'./) or
($ThisLine =~ m/server\s+Recovery of database '.*' will undo
incomplete nested top actions./) or
($ThisLine =~ m/server\s+Started recovery checkpoint for
database '.*'./) or
($ThisLine =~ m/server\s+Completed recovery checkpoint for
database '.*'./) or
($ThisLine =~ m/server\s+Started filling free space info for
database '.*'./) or
($ThisLine =~ m/server\s+Completed filling free space info for
database '.*'./) or
($ThisLine =~ m/server\s+Started recovery checkpoint for
database '.*'./) or
($ThisLine =~ m/server\s+Completed recovery checkpoint for
database '.*'./) or
($ThisLine =~ m/server\s+Started filling free space info for
database '.*'./) or
($ThisLine =~ m/server\s+Completed filling free space info for
database '.*'./) or
($ThisLine =~ m/server\s+Started cleaning up the default data
cache for database '.*'./) or
($ThisLine =~ m/server\s+Completed cleaning up the default data
cache for database '.*'./) or
($ThisLine =~ m/server\s+Checking external objects./) or
($ThisLine =~ m/server\s+Started cleaning up the default data
cache for database '.*'./) or
($ThisLine =~ m/server\s+Completed cleaning up the default data
cache for database '.*'./) or
($ThisLine =~ m/server\s+Started estimating recovery log
boundaries for database '.*'./) or
($ThisLine =~ m/server\s+Redo pass of recovery has processed
[0-9]+ committed and [0-9]+ aborted transactions./) or
($ThisLine =~ m/server\s+Checking .*: Logical pagesize is [0-9]+
bytes/) or
($ThisLine =~ m/kernel\s+Using [0-9]+ file descriptors./) or
($ThisLine =~ m/kernel\s+Logging ASE messages in file '.*'./) or
($ThisLine =~ m/kernel\s+Platform TCP network is forced to
IPv4-only./) or
($ThisLine =~ m/kernel\s+SQL Server booted with TCP_NODELAY
enabled./) or
($ThisLine =~ m/kernel\s+SSL Plus v[0-9.]+ security modules
loaded successfully./) or
($ThisLine =~ m/kernel\s+Network and device connection limit is
[0-9]+./) or
($ThisLine =~ m/kernel\s+Number of blocks left for proc headers:
[0-9]+./) or
($ThisLine =~ m/kernel\s+Unix interval timer enabled for sysclk
interrupts./) or
($ThisLine =~ m/kernel\s+Enabling Linux Kernel asynchronous disk
I\/O strategy./) or
($ThisLine =~ m/kernel\s+Checked out license /) or
($ThisLine =~ m/kernel\s+Adaptive Server Enterprise Developer
Edition./) or
($ThisLine =~ m/kernel\s+Using config area from primary master
device./) or
($ThisLine =~ m/kernel\s+Internal run-time model set for Linux
- Native/) or
($ThisLine =~ m/kernel\s+$/) or
($ThisLine =~ m/^\.$/) or
($ThisLine =~ m/kernel\s+ASE booted on Linux release .*\./) or
($ThisLine =~ m/kernel\s+Using '.*' for configuration
information./) or
($ThisLine =~ m/server\s+Number of blocks left for proc headers:
[0-9]+\./) or
($ThisLine =~ m/server\s+Proc header memory allocated [0-9]+
pages for each per engine cache/) or
($ThisLine =~ m/server\s+Size of the [0-9]+K memory pool: [0-9]+
Kb/) or
($ThisLine =~ m/server\s+Memory allocated for the default data
cache cachelet [0-9]+: [0-9]+ Kb/) or
($ThisLine =~ m/kernel\s+Worker Thread Manager is not enabled
for use in SQL Server./) or
($ThisLine =~ m/kernel\s+Either the config parameter 'use
security services' is set to 0, or ASE does not support use of external
security mechanisms on this platform. The Security Control Layer will
not be initialized. No external security mechanisms will be supported./) or
($ThisLine =~ m/kernel\s+libomni1 - Component Integration
Services loaded;/) or
($ThisLine =~ m/kernel\s+libomni1 - Component Integration
Services: using /) or
($ThisLine =~ m/server\s+Database .* successfully created./) or
($ThisLine =~ m/server\s+Completed estimating recovery log
boundaries for database '.*'./) or
($ThisLine =~ m/server\s+Boot Count: [0-9]+/) or
($ThisLine =~ m/server\s+Now loading SQL Server's new default
sort order and character set/) or
($ThisLine =~ m/server\s+Default Sort Order successfully
changed./) or
($ThisLine =~ m/server\s+SQL Server shutdown after verifying
System Indexes./) or
($ThisLine =~ m/server\s+Configuration file '.*' has been
written and the previous version has been renamed to '.*'./) or
($ThisLine =~ m/kernel\s+O_DSYNC turned off for virtual device
..*/) or
($ThisLine =~ m/kernel\s+Activating disk '.*' of size [0-9]+
KB./) or
($ThisLine =~ m/server\s+The logical pagesize of the server is
[0-9]+ Kb./) or
($ThisLine =~ m/server\s+Database '.*' appears to be at an older
revision than the present installation; SQL Server will assess it, and
upgrade it as required./) or
($ThisLine =~ m/server\s+Transaction coordinator initialized./) or
($ThisLine =~ m/server\s+Clearing temp db/) or
($ThisLine =~ m/server\s+Recovery complete./) or
($ThisLine =~ m/server\s+'bin_iso_1' \(ID = 50\)/) or
($ThisLine =~ m/server\s+'iso_1' \(ID = 1\)./) or
($ThisLine =~ m/server\s+Master device size: [0-9]+ megabytes,
or [0-9]+ virtual pages. \(A virtual page is [0-9]+ bytes.\)/) or
($ThisLine =~ m/server\s+[0-9]+ dump conditions detected at boot
time/) or
($ThisLine =~ m/server\s+Resident Node id: [0-9a-f]+/) or
($ThisLine =~ m/server\s+Opening Master Database .../) or
($ThisLine =~ m/server\s+Resident Node id: [0-9a-f]+/) or
($ThisLine =~ m/server\s+Resident Node id: [0-9a-f]+/) or
($ThisLine =~ m/kernel\s+Initializing device .* from offset
[0-9]+ with zeros./) or
($ThisLine =~ m/kernel\s+Deactivating virtual device [0-9]+,
'.*'./) or
($ThisLine =~ m/kernel\s+Certificate load from file `.*`:
succeeded./) or
($ThisLine =~ m/kernel\s+Certificate load from file '.*':
succeeded./) or
($ThisLine =~ m/kernel\s+Trusted root certificates loaded from
file `.*`: succeeded./) or
($ThisLine =~ m/kernel\s+Trusted root certificates loaded from
file '.*': succeeded./) or
($ThisLine =~ m/server\s+No active traceflags/) or
($ThisLine =~ m/server\s+Loading SQL Server's default sort order
and character set/) or
($ThisLine =~ m/server\s+Loaded default Unilib conversion
handle./) or
($ThisLine =~ m/server\s+server name is '.*'/) or
($ThisLine =~ m/kernel\s+engine [0-9]+, os pid [0-9]+\s+online/) or
($ThisLine =~ m/kernel\s+Finished initialization./) or
($ThisLine =~ m/kernel\s+ueshutdown: exiting/) or
($ThisLine =~ m/kernel\s+Allocating a shared memory segment of
size [0-9]+ bytes./) or
($ThisLine =~ m/Sybase Client-Library\/[0-9.]+\/.*\/.*\/Linux
Intel\//) or
($ThisLine =~ m/Sybase Server-Library\/[0-9.]+\/.*\/.*\/Linux
Intel\//) or
($ThisLine =~ m/server\s+dbcc dbrepair: Clustered index restored
for .*/) or
($ThisLine =~ m/server\s+dbcc dbrepair: Non-clustered index
restored for .*/) or
($ThisLine =~ m/server\s+Checking space allocation for database
[0-9]+/) or
($ThisLine =~ m/server\s+Continuing recovery with the next
database./) or
($ThisLine =~ m/server\s+WARNING:
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*$/) or
($ThisLine =~ m/server\s+Recovery has tuned the '.*' pool in
'.*' by changing its '.*' from [0-9]+ to [0-9]+. The original
configuration will be restored at the end of recovery./) or
($ThisLine =~ m/server\s+The server will recover databases
serially./) or
($ThisLine =~ m/server\s+The wash size of the [0-9]+K buffer
pool in cache default data cache has been changed from [0-9]+ Kb to
[0-9]+ Kb due to a change in the size of the pool./) or
($ThisLine =~ m/server\s+Recovery has restored the value of '.*'
for '.*' pool in '.*' from '.*' to '.*'./) or
($ThisLine =~ m/kernel\s+sslctxsize is [0-9]+ bytes./) or
($ThisLine =~ m/kernel\s+Directory Control Layer \(DCL\) using
directory driver: InterfacesDriver/) or
($ThisLine =~ m/server\s+Warning: ASE_HA has no valid license
and therefore is not initialized./)
) {
# Ignore these
} elsif ($ThisLine =~ /Logon\s+Login succeeded. User: (\S+), Client
IP address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login succeeded. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
if ($Debug >= 5) {
print STDERR "DEBUG: Found -$1 logged in from $2\n";
}
$Users{$1}{$2}{"(all)"}++;
} elsif ($ThisLine =~ /Logon\s+Login failed. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login failed. User: (\S+), Client IP address:
'([\d\.:a-f]+)'./) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found -Failed login- line\n";
}
$BadLogins{"$1 from $2"}++;
} elsif ($ThisLine =~ /server\s+Type '(.*)' not allowed before
login./) {
$BadCharLogins{"$1"}++;
} elsif (
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected: (.*) spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected:\s+spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot allocate resources for listener
with protocol tcp, host (.*), port ([0-9]+), engine ([0-9]+)./) or
($ThisLine =~ m/kernel\s+nrpacket: recv, No route to host/) or
($ThisLine =~ m/kernel\s+nrpacket: recv, Connection timed out/) or
($ThisLine =~ m/server\s+A client process exited abnormally, or a
network error was encountered. Unless other errors occurred, continue
processing normally./) or
($ThisLine =~ m/server\s+There are not enough 'user connections'
available to start a new process. Retry when there are fewer active
users, or ask your System Administrator to reconfigure SQL Server with
more user connections./) or
($ThisLine =~ m/Event buffer wrap: [0-9]+ event\(s\) lost./)
) {
$NetworkErrors++;
} elsif (
($ThisLine =~ m/RepAgent\([0-9]+\): Received the following
communications error message: Msg [0-9]+: .*\(\): network packet layer: .*/)
) {
$NetworkRepAgentErrors++;
} elsif (
($ThisLine =~ m/RepAgent\([0-9]+\): The Rep Agent Thread will
retry the connection to the Replication Server every [0-9]+ second\(s\).
\(RepSvr = .*\)./)
) {
## and ignore the depending stuff of previous error
} elsif ( $ThisLine =~ m/Process id [0-9]+ killed by Hostname (.*),
Host process id [0-9]+./ ) {
$Kills{"$1"}++;
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found -Process id killed- line\n";
}
} elsif (
( $ThisLine =~ m/kernel\s+network name (.*), interface (.*),
address ([^ ]+), type .*, port ([0-9]+), filter (.*)/) or
( $ThisLine =~ m/kernel\s+network name (.*), type (.*), port
([0-9]+), filter (.*)/)
) {
$Starts{"$1"}++;
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found Started -Listening on port $4- line\n";
}
} elsif ( $ThisLine =~ m/server\s+Database '(.*)': beginning upgrade
step/) {
$UpgradeStep{"$1"}++;
} elsif ( $ThisLine =~ m/server\s+CREATE DATABASE: allocating [0-9]+
logical pages \(([0-9.]+) megabytes\) on disk '(.*)'./) {
$CreateDb{"$2"} = $1;
} elsif ( $ThisLine =~ m/server\s+The configuration option 'allow
updates to system tables' has been changed by '(.*)' from '0' to '1'./) {
$AllowUpdatesSystemTables{"$1"}{"0->1"}++;
} elsif ( $ThisLine =~ m/server\s+The configuration option 'allow
updates to system tables' has been changed by '(.*)' from '1' to '0'./) {
$AllowUpdatesSystemTables{"$1"}{"1->0"}++;
} elsif ( $ThisLine =~ m/server\s+DBCC TRACE(ON|OFF) ([0-9]+), SPID
([0-9]+)/) {
$Dbcc{"$1"}{"$2"}{"$3"}++;
} elsif ( $ThisLine =~ m/server\s+Deadlock Id ([0-9]+) detected/) {
$Deadlock{"unknown"}++;
} elsif (
($ThisLine =~ m/^Deadlock Id [0-9]+: Process \(Familyid [0-9]+,
[0-9]+\) \(suid [0-9]+\) was waiting for a '.*' lock on page [0-9]+ of
the '(.*)' table in database [0-9]+ but process \(Familyid [0-9]+, Spid
[0-9]+\) already held a '.*' lock on it/) or
($ThisLine =~ m/^Deadlock Id [0-9]+: Process \(Familyid [0-9]+,
Spid [0-9]+\) \(suid [0-9]+\) was waiting for a '.*' lock on page [0-9]+
of the '(.*)' table in database [0-9]+ but process \(Familyid [0-9]+,
Spid [0-9]+\) already held a '.*' lock on it/) or
($ThisLine =~ m/^Deadlock Id [0-9]+: Process \(Familyid [0-9]+,
Spid [0-9]+\) was waiting for a '.*' lock on page [0-9]+ of the '(.*)'
table in database [0-9]+ but process \(Familyid [0-9]+, Spid [0-9]+\)
already held a '.*' lock on it/)
) {
$Deadlock{"$1"}++;
} elsif (
($ThisLine =~ m/^Deadlock Id [0-9]+: detected. [0-9]+ deadlock
chain\(s\) involved./) or
($ThisLine =~ m/^Deadlock Id [0-9]+: Process \(Familyid [0-9]+
[0-9]+\) \(suid [0-9]+\) was executing a /) or
($ThisLine =~ m/^Deadlock Id [0-9]+: Process \(Familyid [0-9]+,
[0-9]+\) \(suid [0-9]+\) was executing a /) or
($ThisLine =~ m/^SQL Text:/) or
($ThisLine =~ m/^GROUP BY /i) or
($ThisLine =~ m/^ORDER BY /i) or
($ThisLine =~ m/^[\s].*select /i) or
($ThisLine =~ m/^[\s].*from/i) or
($ThisLine =~ m/^[\s].*where/i) or
($ThisLine =~ m/^[\s].*where/i) or
($ThisLine =~ m/
$/i) or
($ThisLine =~ m/^Deadlock Id [0-9]+: Process \(Familyid [0-9]+,
[0-9]+\) was chosen as the victim. End of deadlock information./)
){
## trap deadlock stuff
} elsif ($ThisLine =~ m/SQL Server shutdown by request./) {
$Shutdown++;
} elsif ($ThisLine =~ m/Database '(.*)' set to single user mode./) {
$SingleUser{"$1"}++;
} elsif ($ThisLine =~ m/Error: ([0-9]+), Severity: [0-9]+, State:
[0-9]+/) {
$AseErrors{"$1"}++;
} elsif ($ThisLine =~ m/kernel\s+sddone: No space left on device/) {
$NoSpaceLeft++;
} elsif ($ThisLine =~ m/server\s+WARNING: memory usage in procedure
headers \([0-9]+\)/) {
$WarnMemUsage++;
} else {
# Report any unmatched entries...

# Compress time
$ThisLine =~ s/^[0-9]{2}:[0-9]{5}:[0-9]{5}://;

unless ($ThisLine =~ /fwd X11 connect/) {
push @OtherList, "$ThisLine\n";
}
}
}

###########################################################

if ($NetworkErrors) {
print "\nNetwork Read Write Errors: " . $NetworkErrors . "\n";
}

if ($NetworkRepAgentErrors) {
print "\nNetwork Rep Agent Read Write Errors: " .
$NetworkRepAgentErrors. "\n";
}

if ($NoSpaceLeft) {
print "\nWARNING !!! No space left on device: " . $NoSpaceLeft. "\n";
}

if ($WarnMemUsage) {
print "\nWARNING !!! memory usage in procedure headers: " .
$WarnMemUsage. "\n";
}

if (keys %Kills) {
print "\nProcess id killed by host:\n";
foreach $name (sort {$a cmp $b} keys %Kills) {
print " '$name': " . $Kills{$name} . " Time(s)\n";
}
}

if (keys %Starts) {
print "\n$Service started:\n";
foreach $name (sort {$a cmp $b} keys %Starts) {
print " $name: " . $Starts{$name} . " Time(s)\n";
}
}

if ($Shutdown) {
print "\n$Service Shutdowned: " . $Shutdown. " Time(s)\n";
}

if (keys %BadLogins) {
print "\nFailed logins from these:\n";
for (sort keys %BadLogins) {
print " $_: $BadLogins{$_} Time(s)\n";
}
}

if (keys %BadCharLogins) {
print "\nType 'X' not allowed before login.:\n";
for (sort keys %BadCharLogins) {
print " '$_': $BadCharLogins{$_} Time(s)\n";
}
}

if (keys %Users) {
print "\nUsers logging in through $Service:\n";
foreach $user (sort {$a cmp $b} keys %Users) {
print " $user:\n";
my $totalSort = TotalCountOrder(%{$Users{$user}}, \&SortIP);
foreach my $ip (sort $totalSort keys %{$Users{$user}}) {
my $name = LookupIP($ip);
my $val = (values %{$Users{$user}{$ip}})[0];
my $plural = ($val > 1) ? "s" : "";
print " $name: $val time$plural\n";
}
}
}

if (keys %UpgradeStep) {
print "\nUpgrade Step for db:\n";
foreach $db (sort {$a cmp $b} keys %UpgradeStep) {
print " $db : $UpgradeStep{$db} Time(s)\n";
}
}

if (keys %CreateDb) {
print "\nCreate Database and size:\n";
foreach $db (sort {$a cmp $b} keys %CreateDb) {
print " $db : $CreateDb{$db} megabyte(s)\n";
}
}

if (keys %AllowUpdatesSystemTables) {
print "\nallow updates to system tables:\n";
foreach $user (sort {$a cmp $b} keys %AllowUpdatesSystemTables) {
print " $user\n";
foreach $change (sort {$a cmp $b} keys
%{$AllowUpdatesSystemTables{$user}}) {
print " $change:
$AllowUpdatesSystemTables{$user}{$change} Time(s)\n";
}
}
}

if (keys %Dbcc) {
print "\nDBCC TRACE(ON|OFF) per spid:\n";
foreach $type (sort {$a cmp $b} keys %Dbcc) {
print " TRACE$type\n";
foreach $trace (sort {$a cmp $b} keys %{$Dbcc{$type}}) {
foreach $spid (sort {$a cmp $b} keys %{$Dbcc{$type}{$trace}}) {
print " $trace spid $spid: $Dbcc{$type}{$trace}{$spid}
Time(s)\n";
}
}
}
}

if (keys %Deadlock) {
print "\nDeadlock table:\n";
foreach $id (sort {$a cmp $b} keys %Deadlock) {
print " $id : $Deadlock{$id} Time(s)\n";
}
}

if (keys %AseErrors) {
print "\nErrors\n";
foreach $num (sort {$a cmp $b} keys %AseErrors) {
print " $num: " . $AseErrors{$num} . " Time(s)\n";
}
}

if (keys %SingleUser) {
print "\nSingle User\n";
foreach $db (sort {$a cmp $b} keys %SingleUser) {
print " $db: " . $SingleUser{$db} . " Time(s)\n";
}
}

if ($#OtherList >= 0) {
print "\n**Unmatched Entries**\n";
print @OtherList;
}

exit(0);

# vi: shiftwidth=3 tabstop=3 et

=== /etc/log.d/scripts/services/sybase_back
#!/usr/bin/perl -w
##########################################################################
# $Id: Sybase Backup Server $
##########################################################################

use Logwatch ':all';

$Debug = ValueOrDefault($ENV{'LOGWATCH_DEBUG'}, 0);
$Detail = ValueOrDefault($ENV{'LOGWATCH_DETAIL_LEVEL'}, 0);
$Service = "Sybase Backup Server";

# Avoid "Use of uninitialized value" warning messages.
sub ValueOrDefault {
my ($value, $default) = @_;
return ($value ? $value : $default);
}

# No sense in running if sybase doesn't even exist on this system...
#unless (( -f "$ENV{'SYBASE'}/ASE-12-5/bin/dataserver" ) {
# exit (0);
#}

if ( $Debug >= 5 ) {
print STDERR "\n\nDEBUG: Inside Sybase Backup Filter \n\n";
$DebugCounter = 1;
}

while (defined($ThisLine = <STDIN>)) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG($DebugCounter): $ThisLine";
$DebugCounter++;
}
chomp($ThisLine);
if (
($ThisLine =~ m/Copyright/) or
($ThisLine =~ m/Sybase, Inc. All rights reserved./) or
($ThisLine =~ m/Confidential property of Sybase, Inc.$/) or
($ThisLine =~ m/Unpublished rights reserved under U.S. copyright
laws./) or
($ThisLine =~ m/This software contains confidential and trade
secret information of Sybase,/) or
($ThisLine =~ m/Inc. Use, duplication or disclosure of the
software and documentation by/) or
($ThisLine =~ m/the U.S. Government is subject to
restrictions set forth in a license/) or
($ThisLine =~ m/agreement between the Government and
Sybase, Inc. or other written/) or
($ThisLine =~ m/agreement specifying the Government's rights
to use the software and any/) or
($ThisLine =~ m/applicable FAR provisions, for example, FAR
52.227-19./) or
($ThisLine =~ m/Sybase, Inc. One Sybase Drive, Dublin, CA 94568,
USA/) or

## backup server
($ThisLine =~ m/Backup Server: ([\d\.:a-f]+): Configuring the
maximum shared memory usage to [0-9]+ MB./) or
($ThisLine =~ m/Backup Server: ([\d\.:a-f]+): Configuring the
number of service threads to [0-9]+./) or
($ThisLine =~ m/Backup Server: ([\d\.:a-f]+): Configuring the
shared memory per stripe to [0-9]+ bytes./) or
($ThisLine =~ m/Backup Server\/[0-9.]+\/.*\/P\/Linux
Intel\/Enterprise Linux\//) or
($ThisLine =~ m/Logging Backup Server messages in file '.*'/) or
($ThisLine =~ m/Backup Server: [0-9.]+: Database .*: [0-9]+
kilobytes LOADed./) or
($ThisLine =~ m/Backup Server: [0-9.]+: Database (.*): [0-9]+
kilobytes DUMPed./) or
($ThisLine =~ m/Backup Server: [0-9.]+: Creating new disk file
..*\./) or
($ThisLine =~ m/Backup Server: [0-9.]+: Dump phase number [0-9]+
completed./) or
($ThisLine =~ m/Backup Server: [0-9.]+: Dumpfile name '.*'
section number [0-9]+ mounted on disk file '.*'/)
) {
# Ignore these
} elsif ($ThisLine =~ /Logon\s+Login succeeded. User: (\S+), Client
IP address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login succeeded. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
if ($Debug >= 5) {
print STDERR "DEBUG: Found -$1 logged in from $2\n";
}
$Users{$1}{$2}{"(all)"}++;
} elsif ($ThisLine =~ /Logon\s+Login failed. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login failed. User: (\S+), Client IP address:
'([\d\.:a-f]+)'./) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found -Failed login- line\n";
}
$BadLogins{"$1 from $2"}++;
} elsif (
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected: (.*) spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected:\s+spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot allocate resources for listener
with protocol tcp, host (.*), port ([0-9]+), engine ([0-9]+)./) or
($ThisLine =~ m/kernel\s+nrpacket: recv, No route to host/) or
($ThisLine =~ m/kernel\s+nrpacket: recv, Connection timed out/) or
($ThisLine =~ m/server\s+A client process exited abnormally, or a
network error was encountered. Unless other errors occurred, continue
processing normally./) or
($ThisLine =~ m/server\s+There are not enough 'user connections'
available to start a new process. Retry when there are fewer active
users, or ask your System Administrator to reconfigure SQL Server with
more user connections./) or
($ThisLine =~ m/Event buffer wrap: [0-9]+ event\(s\) lost./)
) {
$NetworkErrors++;
} elsif ($ThisLine =~ m/SQL Server shutdown by request./) {
$Shutdown++;
} elsif (
($ThisLine =~ m/Backup Server: [0-9.]+: DUMP is complete
\(database (.*)\)./)
) {
## ?
$DumpDB{"$1"}++;
} elsif (
($ThisLine =~ m/Backup Server: [0-9.]+: LOAD is complete
\(database (.*)\)./)
) {
$LoadDB{"$1"}++;
} else {
# Report any unmatched entries...
push @OtherList, "$ThisLine\n";
}
}

###########################################################

if ($NetworkErrors) {
print "\nNetwork Read Write Errors: " . $NetworkErrors . "\n";
}

if (keys %Starts) {
print "\n$Service started:\n";
foreach $name (sort {$a cmp $b} keys %Starts) {
print " $name: " . $Starts{$name} . " Time(s)\n";
}
}

if ($Shutdown) {
print "\n$Service Shutdowned: " . $Shutdown. " Time(s)\n";
}

if (keys %BadLogins) {
print "\nFailed logins from these:\n";
for (sort keys %BadLogins) {
print " $_: $BadLogins{$_} Time(s)\n";
}
}

if (keys %Users) {
print "\nUsers logging in through $Service:\n";
foreach $user (sort {$a cmp $b} keys %Users) {
print " $user:\n";
my $totalSort = TotalCountOrder(%{$Users{$user}}, \&SortIP);
foreach my $ip (sort $totalSort keys %{$Users{$user}}) {
my $name = LookupIP($ip);
my $val = (values %{$Users{$user}{$ip}})[0];
my $plural = ($val > 1) ? "s" : "";
print " $name: $val time$plural\n";
}
}
}

if (keys %DumpDB) {
print "\nDump DB\n";
foreach $db (sort {$a cmp $b} keys %DumpDB) {
print " $db: " . $DumpDB{$db} . " Time(s)\n";
}
}

if (keys %LoadDB) {
print "\nLoad DB\n";
foreach $db (sort {$a cmp $b} keys %LoadDB) {
print " $db: " . $LoadDB{$db} . " Time(s)\n";
}
}

if ($#OtherList >= 0) {
print "\n**Unmatched Entries**\n";
print @OtherList;
}

exit(0);

# vi: shiftwidth=3 tabstop=3 et

=== /etc/log.d/scripts/services/sybase_mon
#!/usr/bin/perl -w
##########################################################################
# $Id: Sybase Monitor & Historical Server $
##########################################################################

use Logwatch ':all';

$Debug = ValueOrDefault($ENV{'LOGWATCH_DEBUG'}, 0);
$Detail = ValueOrDefault($ENV{'LOGWATCH_DETAIL_LEVEL'}, 0);
$Service = "Sybase Monitor & Historical Server";

# Avoid "Use of uninitialized value" warning messages.
sub ValueOrDefault {
my ($value, $default) = @_;
return ($value ? $value : $default);
}

# No sense in running if sybase doesn't even exist on this system...
#unless (( -f "$ENV{'SYBASE'}/ASE-12-5/bin/dataserver" ) {
# exit (0);
#}

my $sftpRequests = 0;

if ( $Debug >= 5 ) {
print STDERR "\n\nDEBUG: Inside Sybase Mon & Hist Filter \n\n";
$DebugCounter = 1;
}

while (defined($ThisLine = <STDIN>)) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG($DebugCounter): $ThisLine";
$DebugCounter++;
}
chomp($ThisLine);
if (
($ThisLine =~ m/Copyright/) or
($ThisLine =~ m/Sybase, Inc. All rights reserved./) or
($ThisLine =~ m/Confidential property of Sybase, Inc.$/) or
($ThisLine =~ m/Unpublished rights reserved under U.S. copyright
laws./) or
($ThisLine =~ m/This software contains confidential and trade
secret information of Sybase,/) or
($ThisLine =~ m/Inc. Use, duplication or disclosure of the
software and documentation by/) or
($ThisLine =~ m/the U.S. Government is subject to
restrictions set forth in a license/) or
($ThisLine =~ m/agreement between the Government and
Sybase, Inc. or other written/) or
($ThisLine =~ m/agreement specifying the Government's rights
to use the software and any/) or
($ThisLine =~ m/applicable FAR provisions, for example, FAR
52.227-19./) or
($ThisLine =~ m/Sybase, Inc. One Sybase Drive, Dublin, CA 94568,
USA/) or
## Monitor & Historical server
($ThisLine =~ m/Server version: Adaptive Server
Enterprise\/[0-9.]+\//) or
($ThisLine =~ m/Monitor Server\/[0-9.]+\/.*\/P\/Linux
Intel\/Enterprise Linux\//) or
($ThisLine =~ m/Monitor Historical Server\/[0-9.]+\/.*\//) or
($ThisLine =~ m/Configuration Information:$/) or
($ThisLine =~ m/--------------------------$/) or
($ThisLine =~ m/^$/) or
($ThisLine =~ m/Server shared memory size \(bytes\) = [0-9]+/) or
($ThisLine =~ m/Maximum number of server engines [0-9]+/) or
($ThisLine =~ m/Number of event buffers configured [0-9]+/) or
($ThisLine =~ m/Size of memory blocks used for summarizing
events = [0-9]+ KB/) or
($ThisLine =~ m/Maximum number of memory blocks per summary =
[0-9]+/) or
($ThisLine =~ m/Maximum number of summaries per client
connection = [0-9]+/) or
($ThisLine =~ m/Maximum number of client connections = [0-9]+/) or
($ThisLine =~ m/Maximum number of filtering criteria = [0-9]+/) or
($ThisLine =~ m/Maximum value permitted for pid, dbid and
engine_id filters = [0-9]+/) or
($ThisLine =~ m/Initial amount of memory required by the monitor
server = [0-9]+/) or
($ThisLine =~ m/Initialization is over. Ready to accept
connections/) or
($ThisLine =~ m/CT-Library Version:$/) or
($ThisLine =~ m/Open Server Version:$/) or
($ThisLine =~ m/^[A-Z]{1}[a-z]{2} [0-9]+ [0-9]+:[0-9]+:[0-9]+
[0-9]{4}:\s+$/) or
($ThisLine =~ m/Server name: .*/) or
($ThisLine =~ m/: Sybase Client-Library/) or
($ThisLine =~ m/: Sybase Server-Library/) or
($ThisLine =~ m/: Command line: /) or
($ThisLine =~ m/Additional diagnostic information:-/)
# ($ThisLine =~ m/
) {
# Ignore these
} elsif ($ThisLine =~ /Logon\s+Login succeeded. User: (\S+), Client
IP address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login succeeded. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
if ($Debug >= 5) {
print STDERR "DEBUG: Found -$1 logged in from $2\n";
}
$Users{$1}{$2}{"(all)"}++;
} elsif ($ThisLine =~ /Logon\s+Login failed. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login failed. User: (\S+), Client IP address:
'([\d\.:a-f]+)'./) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found -Failed login- line\n";
}
$BadLogins{"$1 from $2"}++;
} elsif (
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected: (.*) spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected:\s+spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot allocate resources for listener
with protocol tcp, host (.*), port ([0-9]+), engine ([0-9]+)./) or
($ThisLine =~ m/kernel\s+nrpacket: recv, No route to host/) or
($ThisLine =~ m/kernel\s+nrpacket: recv, Connection timed out/) or
($ThisLine =~ m/server\s+A client process exited abnormally, or a
network error was encountered. Unless other errors occurred, continue
processing normally./) or
($ThisLine =~ m/server\s+There are not enough 'user connections'
available to start a new process. Retry when there are fewer active
users, or ask your System Administrator to reconfigure SQL Server with
more user connections./) or
($ThisLine =~ m/Event buffer wrap: [0-9]+ event\(s\) lost./)
) {
$NetworkErrors++;
} elsif (
($ThisLine =~ m/SQL Server seems to be down. Shutting down the
monitor server./)
) {
$ShutdownWithAse++;
} elsif (
($ThisLine =~ m/Unable to attach to kernel region/)
) {
$UnableToAttach++;
} elsif (
($ThisLine =~ m/Unable to attach with shared memory./)
) {
$UnableToAttachSharedMem++;
} else {
# Report any unmatched entries...
push @OtherList, "$ThisLine\n";
}
}

###########################################################

if ($NetworkErrors) {
print "\nNetwork Read Write Errors: " . $NetworkErrors . "\n";
}

if ($UnableToAttach) {
print "\nUnable to attach to kernel region: " . $UnableToAttach. "\n";
}

if ($UnableToAttachSharedMem) {
print "\nUnable to attach to shared memory: " .
$UnableToAttachSharedMem. "\n";
}

if (keys %Starts) {
print "\n$Service started:\n";
foreach $name (sort {$a cmp $b} keys %Starts) {
print " $name: " . $Starts{$name} . " Time(s)\n";
}
}

if ($ShutdownWithAse) {
print "\nSQL Server seems to be down. Shutting down the monitor
server.: " . $ShutdownWithAse. " Time(s)\n";
}

if (keys %BadLogins) {
print "\nFailed logins from these:\n";
for (sort keys %BadLogins) {
print " $_: $BadLogins{$_} Time(s)\n";
}
}

if (keys %Users) {
print "\nUsers logging in through $Service:\n";
foreach $user (sort {$a cmp $b} keys %Users) {
print " $user:\n";
my $totalSort = TotalCountOrder(%{$Users{$user}}, \&SortIP);
foreach my $ip (sort $totalSort keys %{$Users{$user}}) {
my $name = LookupIP($ip);
my $val = (values %{$Users{$user}{$ip}})[0];
my $plural = ($val > 1) ? "s" : "";
print " $name: $val time$plural\n";
}
}
}

if ($#OtherList >= 0) {
print "\n**Unmatched Entries**\n";
print @OtherList;
}

exit(0);

# vi: shiftwidth=3 tabstop=3 et

=== /etc/log.d/scripts/services/sybase_rs
#!/usr/bin/perl -w
##########################################################################
# $Id: Sybase Replication Server $
##########################################################################

use Logwatch ':all';

$Debug = ValueOrDefault($ENV{'LOGWATCH_DEBUG'}, 0);
$Detail = ValueOrDefault($ENV{'LOGWATCH_DETAIL_LEVEL'}, 0);
$Service = "Sybase Replication Server";

# Avoid "Use of uninitialized value" warning messages.
sub ValueOrDefault {
my ($value, $default) = @_;
return ($value ? $value : $default);
}

# No sense in running if sybase doesn't even exist on this system...
#unless (( -f "$ENV{'SYBASE'}/ASE-12-5/bin/dataserver" ) {
# exit (0);
#}

if ( $Debug >= 5 ) {
print STDERR "\n\nDEBUG: Inside Sybase RS Filter \n\n";
$DebugCounter = 1;
}

while (defined($ThisLine = <STDIN>)) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG($DebugCounter): $ThisLine";
$DebugCounter++;
}
chomp($ThisLine);
if (
($ThisLine =~ m/Copyright/) or
($ThisLine =~ m/Sybase, Inc. All rights reserved./) or
($ThisLine =~ m/Confidential property of Sybase, Inc.$/) or
($ThisLine =~ m/Unpublished rights reserved under U.S. copyright
laws./) or
($ThisLine =~ m/This software contains confidential and trade
secret information of Sybase,/) or
($ThisLine =~ m/Inc. Use, duplication or disclosure of the
software and documentation by/) or
($ThisLine =~ m/the U.S. Government is subject to
restrictions set forth in a license/) or
($ThisLine =~ m/agreement between the Government and
Sybase, Inc. or other written/) or
($ThisLine =~ m/agreement specifying the Government's rights
to use the software and any/) or
($ThisLine =~ m/applicable FAR provisions, for example, FAR
52.227-19./) or
($ThisLine =~ m/Sybase, Inc. One Sybase Drive, Dublin, CA 94568,
USA/) or
## replication server
($ThisLine =~ m/Replication Server\/[0-9.]+\//) or
($ThisLine =~ m/^I\. .* Server name is '.*'./) or
($ThisLine =~ m/^I\. .* Logging messages in file '.*'./) or
($ThisLine =~ m/^I\. .* Using interfaces file '.*'./) or
($ThisLine =~ m/^I\. .* Using the '.*' language./) or
($ThisLine =~ m/^I\. .* Using the '.*' sort order./) or
($ThisLine =~ m/^I\. .* Using the '.*' unicode sort order./) or
($ThisLine =~ m/^I\. .* Using the '.*' character set./) or
($ThisLine =~ m/^I\. .* Using user '.*' for the ID Server./) or
($ThisLine =~ m/^I\. .* Using config file maintenance password
for the RSSD maint user./) or
($ThisLine =~ m/^I\. .* RSSD maintenace user is '.*'./) or
($ThisLine =~ m/^I\. .* RSSD primary user is '.*'./) or
($ThisLine =~ m/^I\. .* RSSD database is '.*'./) or
($ThisLine =~ m/^I\. .* Reading '.*' for system configuration
parameters./) or
($ThisLine =~ m/^I\. .* Value of the '.*' config parameter is:
[0-9]+ megabytes./) or
($ThisLine =~ m/^I\. .* System outbound connection fadeout time:
'[0-9]+'./) or
($ThisLine =~ m/^I\. .* System table cache size: [0-9]+ rows./) or
($ThisLine =~ m/^I\. .* Password encryption option: [01]?./) or
($ThisLine =~ m/^I\. .* Use SSL service is set to '(off|on)'./) or
($ThisLine =~ m/^I\. .* Default for connection ha_failover is
set to '(off|on)',/) or
($ThisLine =~ m/^I\. .* Default directory service provider is:
'InterfacesDriver'./) or
($ThisLine =~ m/^I\. .* System configuration complete./) or
($ThisLine =~ m/^I\. .* Server using Open Server version Sybase
Server-Library\/[0-9.]+\//) or
($ThisLine =~ m/^I\. .* Server site id is '[0-9]+'./) or
($ThisLine =~ m/^I\. .* Embedded database id is '[0-9]+'./) or
($ThisLine =~ m/^I\. .* Replication Server '.*' is started./) or
($ThisLine =~ m/^I\. .* /) or
($ThisLine =~ m/^I\. .* Maximum number of /) or
($ThisLine =~ m/^I\. .* SQM starting: /) or
($ThisLine =~ m/^I\. .* Replication Agent for .* connected in
passthru mode./) or
($ThisLine =~ m/^I\. .* DIST for '.*' is Starting/) or
($ThisLine =~ m/^I\. .* Reading '.*' for configuration
information./) or
($ThisLine =~ m/^I\. .* Using config file password for the ID
user./) or
($ThisLine =~ m/^I\. .* Using config file password for the RSSD
primary user./) or
($ThisLine =~ m/^I\. .* Maximum outbound connections allowed:
[0-9]+./) or
($ThisLine =~ m/^I\. .* SMP capability is set to : '.*'/) or
($ThisLine =~ m/^I\. .* The DSI thread for database '.*' is
started./) or
($ThisLine =~ m/^I\. .* The DSI thread for database '.*' is
shutdown./)
# ($ThisLine =~ m/
) {
# Ignore these
} elsif ($ThisLine =~ /Logon\s+Login succeeded. User: (\S+), Client
IP address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login succeeded. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
if ($Debug >= 5) {
print STDERR "DEBUG: Found -$1 logged in from $2\n";
}
$Users{$1}{$2}{"(all)"}++;
} elsif ($ThisLine =~ /Logon\s+Login failed. User: (\S+), Client IP
address: '([\d\.:a-f]+)'./) {
# } elsif ($ThisLine =~ /Login failed. User: (\S+), Client IP address:
'([\d\.:a-f]+)'./) {
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found -Failed login- line\n";
}
$BadLogins{"$1 from $2"}++;
} elsif (
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected: (.*) spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot (read|send), host process
disconnected:\s+spid: ([0-9]+)/) or
($ThisLine =~ m/kernel\s+Cannot allocate resources for listener
with protocol tcp, host (.*), port ([0-9]+), engine ([0-9]+)./) or
($ThisLine =~ m/kernel\s+nrpacket: recv, No route to host/) or
($ThisLine =~ m/kernel\s+nrpacket: recv, Connection timed out/) or
($ThisLine =~ m/server\s+A client process exited abnormally, or a
network error was encountered. Unless other errors occurred, continue
processing normally./) or
($ThisLine =~ m/server\s+There are not enough 'user connections'
available to start a new process. Retry when there are fewer active
users, or ask your System Administrator to reconfigure SQL Server with
more user connections./) or
($ThisLine =~ m/Event buffer wrap: [0-9]+ event\(s\) lost./)
) {
$NetworkErrors++;
} elsif ( $ThisLine =~ m/kernel\s+network name (.*), interface (.*),
address ([^ ]+), type .*, port ([0-9]+), filter (.*)/) {
$Starts{"$1"}++;
if ( $Debug >= 5 ) {
print STDERR "DEBUG: Found -Listening on port $4- line\n";
}
} elsif ($ThisLine =~ m/E\. .* ERROR #([0-9].*) DSI EXEC\([^ ]*
(.*)\) - /) {
$DsiErrors{"$2"}{"$1"}++;
} elsif ($ThisLine =~ m/E\. .* ERROR #([0-9].*) DSI\([^ ]* (.*)\) - /) {
$Errors{"$2"}{"$1"}++;
} elsif ($ThisLine =~ m/W\. .* WARNING #([0-9].*) (.*)\) - /) {
$Warnings{"$1"}{"$2"}++;
} elsif ($ThisLine =~ m/I\. .* Message from server: Message:
([0-9].*), State [0-9]+, Severity [0-9]+ -- (.*)$/) {
$MsgFromServer{"$1"}{"$2"}++;
} elsif ($ThisLine =~ m/I\. .* Replication Agent version \([0-9]+\)
for '(.*)' does not match the default LTI version for this Replication
Server [0-9]+ using version [0-9]+./) {
$RepAgentLTI{"$1"}++;
} elsif ($ThisLine =~ m/I\. .* A grouped transaction of [0-9]+
individual transactions has failed in database '(.*)'. Each transaction
in the group will be executed individually./) {
$GroupTransaction{"$1"}++;
} elsif ($ThisLine =~ m/I\. .* Shutting down./) {
$ShutdownsRS++;
} else {
# Report any unmatched entries...

# Compress time
$ThisLine =~ s/^[0-9]{2}:[0-9]{5}:[0-9]{5}://;
unless ($ThisLine =~ /fwd X11 connect/) {
push @OtherList, "$ThisLine\n";
}
}
}

###########################################################

if ($NetworkErrors) {
print "\nNetwork Read Write Errors: " . $NetworkErrors . "\n";
}

if (keys %Starts) {
print "\n$Service started:\n";
foreach $name (sort {$a cmp $b} keys %Starts) {
print " $name: " . $Starts{$name} . " Time(s)\n";
}
}

if (keys %BadLogins) {
print "\nFailed logins from these:\n";
for (sort keys %BadLogins) {
print " $_: $BadLogins{$_} Time(s)\n";
}
}

if (keys %Users) {
print "\nUsers logging in through $Service:\n";
foreach $user (sort {$a cmp $b} keys %Users) {
print " $user:\n";
my $totalSort = TotalCountOrder(%{$Users{$user}}, \&SortIP);
foreach my $ip (sort $totalSort keys %{$Users{$user}}) {
my $name = LookupIP($ip);
my $val = (values %{$Users{$user}{$ip}})[0];
my $plural = ($val > 1) ? "s" : "";
print " $name: $val time$plural\n";
}
}
}

if (keys %DsiErrors) {
print "\nDSI Errors:\n";
foreach $db (sort {$a cmp $b} keys %DsiErrors) {
print " $db\n";
foreach $err (sort {$a cmp $b} keys %{$DsiErrors{$db}}) {
print " ERR#$err: $DsiErrors{$db}{$err} Time(s)\n";
}
}
}

if (keys %Errors) {
print "\nOthers Errors:\n";
foreach $db (sort {$a cmp $b} keys %Errors) {
print " $db\n";
foreach $err (sort {$a cmp $b} keys %{$Errors{$db}}) {
print " ERR#$err: $Errors{$db}{$err} Time(s)\n";
}
}
}

if (keys %Warnings) {
print "\nWarnings:\n";
foreach $code (sort {$a cmp $b} keys %Warnings) {
foreach $err (sort {$a cmp $b} keys %{$Warnings{$code}}) {
print " WARNING#$code - $err: $Warnings{$code}{$err}
Time(s)\n";
}
}
}

if (keys %MsgFromServer) {
print "\nMessage from server:\n";
foreach $code (sort {$a cmp $b} keys %MsgFromServer) {
print " $code\n";
foreach $err (sort {$a cmp $b} keys %{$MsgFromServer{$code}}) {
print " $err: $MsgFromServer{$code}{$err} Time(s)\n";
}
}
}

if (keys %RepAgentLTI) {
print "\nReplication Agent version (X) for 'XXX' does not match the
default LTI version for this Replication Server X using version X.:\n";
foreach $db (sort {$a cmp $b} keys %RepAgentLTI) {
print " $db : $RepAgentLTI{$db} Time(s)\n";
}
}

if (keys %GroupTransaction) {
print "\nA grouped transaction of X individual transactions has
failed in database 'XXX'. Each transaction in the group will be executed
individually:\n";
foreach $db (sort {$a cmp $b} keys %GroupTransaction) {
print " $db : $GroupTransaction{$db} Time(s)\n";
}
}

if ($ShutdownsRS) {
print "\nShutdowns: " . $ShutdownsRS. "\n";
}

if (keys %Deadlock) {
print "\nDeadlock table:\n";
foreach $id (sort {$a cmp $b} keys %Deadlock) {
print " $id : $Deadlock{$id} Time(s)\n";
}
}

if (keys %SingleUser) {
print "\nSingle User";
foreach $db (sort {$a cmp $b} keys %SingleUser) {
print "\n $db: " . $SingleUser{$db} . " Time(s)\n";
}
}

if ($#OtherList >= 0) {
print "\n**Unmatched Entries**\n";
print @OtherList;
}

exit(0);

# vi: shiftwidth=3 tabstop=3 et

===

 >> Stay informed about: logwatch script comments 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Bcp out / in all tables with a generic script - Hello Is there a way of bcp out and then in all tables in sybase? if so can someone please help? I just dont want to hard code every single table in a script if possible Sybase version is 12.5.2 on solaris Thank you very much Teresa

isql script calling other script - In Oracle, sqlplus scripts can call other script by using @ or @@ Can I do the same thing in sybase's isql script? The only ways for a isql command to execute a external script file I konw of are: using -i option, or redirect using < But I cannot ha...

Need help with a Sybase script to set the number of open o.. - Currently I must manually complete the following commands to set a new value for the "open objects" and "open indexes". I need a way script this process in a batch file. COMMANDS RAN: This is nothing to script, these commands obtai...

Sybase generic script row count all tables - Hi I would like a generic Sybase script that would select all the tables and then does a row count of all tables. Something like this select * from sysobjects where type ='U' order by name Then this will do a row count of all tables in a database..

How to dump schema script to recreate the database. - My client's customer gave us a sample IAnywhere database that we can query. What is the difference between sybase and IAnywhere? When I click on "about" it says "Adaptive Server Anywhere Network Server Version 9.0.2.2451". Since it ...
   Database Forums (Home) -> Sybase All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]