This is an automated email from the ASF dual-hosted git repository.
curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 9ba8cc0 Allow descriptions of tools
9ba8cc0 is described below
commit 9ba8cc08af71e33358b1450b3b9a15ba3f7a1108
Author: Shane Curcuru <[email protected]>
AuthorDate: Sun May 5 17:06:33 2019 -0400
Allow descriptions of tools
---
lib/whimsy/logparser.rb | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/lib/whimsy/logparser.rb b/lib/whimsy/logparser.rb
index 471e9aa..f3ab9a8 100755
--- a/lib/whimsy/logparser.rb
+++ b/lib/whimsy/logparser.rb
@@ -13,7 +13,16 @@ module LogParser
ERROR_LOG_DIR = '/srv/whimsy/www/members/log'
# Constants and ignored regex for whimsy_access logs
- WHIMSY_APPS = %w(roster board public secretary site.cgi pods.cgi
foundation/orgchart status)
+ WHIMSY_APPS = {
+ 'roster' => 'Roster tool',
+ 'board' => 'Board agenda/minutes',
+ 'public' => 'Public JSON files',
+ 'secretary' => 'Secretary Workbench',
+ 'site.cgi' => 'TLP Site Checker',
+ 'pods.cgi' => 'Podling Site Checker',
+ 'foundation/orgchart' => 'Public OrgChart',
+ 'status' => 'Server Status'
+ }
RUSER = 'remote_user'
REFERER = 'referer'
REMAINDER = 'remainder'
@@ -80,11 +89,11 @@ module LogParser
# Collate/partition whimsy_access entries by app areas
# @param logs full set of items to scan
- # @return apps - WHIMSY_APPS categorized, with REMAINDER entry all others
- def collate_whimsy_access(logs)
+ # @return apps categorized by apphash, with REMAINDER entry all others not
captured
+ def collate_whimsy_access(logs, apphash = WHIMSY_APPS)
remainder = logs
apps = {}
- WHIMSY_APPS.each do |a|
+ apphash.keys.each do |a|
apps[a] = Hash.new{|h,k| h[k] = [] }
apps[a][RUSER] = Hash.new{|h,k| h[k] = 0 }
apps[a][REFERER] = Hash.new{|h,k| h[k] = 0 }