From: Siraaj Khandkar Date: Mon, 2 Nov 2020 14:14:01 +0000 (-0500) Subject: Remove loggers report from motd X-Git-Url: https://git.xandkar.net/?p=khome.git;a=commitdiff_plain;h=fecd278107b2fad9492187c466558eece2a0e76a Remove loggers report from motd but keep it as independent command function. --- diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index e17c5c6..9730feb 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -582,30 +582,6 @@ motd() { ' \ | flat_top_5 \ | indent "${indent_unit}" - - echo - - echo 'Loggers (top 5)' - awk ' - { - split($5, prog, "[") - sub(":$", "", prog[1]) # if there were no [], than : will is left behind - print prog[1] - }' /var/log/syslog \ - | awk ' - { - n = split($1, path, "/") # prog may be in path form - prog = path[n] - total++ - count[prog]++ - } - - END { - for (prog in count) - print count[prog], total, prog - }' \ - | flat_top_5 \ - | indent "${indent_unit}" } ssh_invalid_attempts_from() { @@ -629,3 +605,26 @@ ssh_invalid_attempts_from() { | bar_gauge -v width="$(stty size | awk '{print $2}')" -v num=1 -v ch_right=' ' -v ch_left=' ' -v ch_blank=' ' \ | column -t } + +loggers() { + awk ' + { + split($5, prog, "[") + sub(":$", "", prog[1]) # if there were no [], than : will is left behind + print prog[1] + }' /var/log/syslog \ + | awk ' + { + n = split($1, path, "/") # prog may be in path form + prog = path[n] + total++ + count[prog]++ + } + + END { + for (prog in count) + print count[prog], total, prog + }' \ + | bar_gauge -v num=1 -v ch_right=' ' -v ch_left=' ' -v ch_blank=' ' \ + | column -t +}