Initial commit
This commit is contained in:
commit
33340dc9dd
5 changed files with 119 additions and 0 deletions
8
LICENSE
Normal file
8
LICENSE
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Copyright (c) 2014 Nis Wechselberg
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Prosody-Logwatch
|
||||||
|
|
||||||
|
Scripts to extend logwatch to parse Logfiles from Prosody XMPP-Server.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
AntennaPod is licensed under the MIT License. You can find the license text in the LICENSE file.
|
12
conf/logfiles/chatlog.conf
Normal file
12
conf/logfiles/chatlog.conf
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# What actual file? Defaults to LogPath if not absolute path....
|
||||||
|
LogFile = prosody/prosody.log
|
||||||
|
LogFile = prosody/prosody.err
|
||||||
|
LogFile = prosody/prosody.log.1
|
||||||
|
LogFile = prosody/prosody.err.1
|
||||||
|
|
||||||
|
|
||||||
|
# If the archives are searched, here is one or more line
|
||||||
|
# (optionally containing wildcards) that tell where they are...
|
||||||
|
#If you use a "-" in naming add that as well -mgt
|
||||||
|
Archive = prosody/prosody.log.*.gz
|
||||||
|
Archive = prosody/prosody.err.*.gz
|
14
conf/services/prosody.conf
Normal file
14
conf/services/prosody.conf
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# You can put comments anywhere you want to. They are effective for the
|
||||||
|
# rest of the line.
|
||||||
|
|
||||||
|
# this is in the format of <name> = <value>. Whitespace at the beginning
|
||||||
|
# and end of the lines is removed. Whitespace before and after the = sign
|
||||||
|
# is removed. Everything is case *insensitive*.
|
||||||
|
|
||||||
|
# Yes = True = On = 1
|
||||||
|
# No = False = Off = 0
|
||||||
|
|
||||||
|
Title = "Prosody"
|
||||||
|
|
||||||
|
# Which logfile group...
|
||||||
|
LogFile = chatlog
|
78
scripts/services/prosody
Executable file
78
scripts/services/prosody
Executable file
|
@ -0,0 +1,78 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
my $Debug = $ENV{'PROSODY_DEBUG'} || 0;
|
||||||
|
my $Detail = $ENV{'prosody_detail'} || $ENV{'PROSODY_DETAIL_LEVEL'} || 0;
|
||||||
|
my $IgnoreHost = $ENV{'prosody_ignore_host'} || "";
|
||||||
|
|
||||||
|
if ( $Debug >= 5 ) {
|
||||||
|
print STDERR "\n\nDEBUG \n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
while (defined($ThisLine = <STDIN>)) {
|
||||||
|
# remove timestamp. We can't use *RemoveHeaders because we need the
|
||||||
|
# service name
|
||||||
|
# $ThisLine =~ s/^\w{3} .\d \d\d:\d\d:\d\d (?:[^\s:]* |)//;
|
||||||
|
$ThisLine =~ s/^\w{3} .\d \d\d:\d\d:\d\d //;
|
||||||
|
if ( $ThisLine =~ /Re-opening log files/ or
|
||||||
|
$ThisLine =~ /^jabber.enbewe.de:saslauth/ or
|
||||||
|
$ThisLine =~ /^c2s.*?Client connected/ or
|
||||||
|
$ThisLine =~ /mod_posix.*?Received SIGHUP/ or
|
||||||
|
$ThisLine =~ /general.*?Reloading configuration file/ or
|
||||||
|
$ThisLine =~ /c2s.*?Client disconnected/ or
|
||||||
|
$ThisLine =~ /^s2sin.*?incoming s2s stream (.*?)->jabber.enbewe.de closed/ or
|
||||||
|
$ThisLine =~ /sent dialback key on outgoing s2s stream/ or
|
||||||
|
$ThisLine =~ /s2sout.*?outgoing s2s stream jabber.enbewe.de->(.*?) closed/ ) {
|
||||||
|
# We don't care about these
|
||||||
|
} elsif ( $ThisLine =~ /^s2sin.*?incoming s2s connection ([^\s]*?)->jabber.enbewe.de complete/ ) {
|
||||||
|
# Count incoming connections
|
||||||
|
$IncComplete{$1}++;
|
||||||
|
} elsif ( $ThisLine =~ /^s2sout.*?Beginning new connection attempt to ([^\s]*?)/ ) {
|
||||||
|
# Outgoing attempts
|
||||||
|
$OutAttempt{$1}++;
|
||||||
|
} elsif ( $ThisLine =~ /^s2sout.*?outgoing s2s connection jabber.enbewe.de->([^\s]*?) complete/ ) {
|
||||||
|
# Outgoing complete
|
||||||
|
$OutComplete{$1}++;
|
||||||
|
} elsif ( $ThisLine =~ /c2s.*?Authenticated as ([^\s]*?)$/ ) {
|
||||||
|
# Connected users
|
||||||
|
$Authenticated{$1}++;
|
||||||
|
} else {
|
||||||
|
# Report any unmatched entries...
|
||||||
|
chomp($ThisLine);
|
||||||
|
$OtherList{$ThisLine}++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################
|
||||||
|
|
||||||
|
if ( ( keys %IncComplete ) or ( keys %OutComplete ) ) {
|
||||||
|
print "\nS2S Connections:".
|
||||||
|
"\n====================================".
|
||||||
|
"\n Incoming:";
|
||||||
|
|
||||||
|
foreach $Host ( sort keys %IncComplete ) {
|
||||||
|
print "\n $Host: $IncComplete{$Host}";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n\n Outgoing:";
|
||||||
|
|
||||||
|
foreach $Host ( sort keys %OutComplete ) {
|
||||||
|
print "\n $Host: $OutComplete{$Host}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( keys %Authenticated ) {
|
||||||
|
print "\n\nUser logins:".
|
||||||
|
"\n====================================";
|
||||||
|
|
||||||
|
foreach $User ( sort {$a cmp $b} keys %Authenticated ) {
|
||||||
|
print "\n $User: $Authenticated{$User}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keys %OtherList) {
|
||||||
|
print "\n\n**Unmatched Entries**\n";
|
||||||
|
foreach $line (sort {$a cmp $b} keys %OtherList) {
|
||||||
|
print " $line: $OtherList{$line} Time(s)\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
Loading…
Reference in a new issue