Line 266: |
Line 266: |
| | | |
| <nowiki>echo -n "TLD to review: "; read TLD; qploggrep $TLD\> |tai64nlocal |awk '{print $1 " " $2 "\t" $4 "\t" $5 "\t" $6 "\t" $7}'</nowiki> | | <nowiki>echo -n "TLD to review: "; read TLD; qploggrep $TLD\> |tai64nlocal |awk '{print $1 " " $2 "\t" $4 "\t" $5 "\t" $6 "\t" $7}'</nowiki> |
| + | |
| + | ===Count emails by TLD and disposition for today and yesterday=== |
| + | |
| + | This command will scan all qpsmtpd log files closed in the last day, then pull out entries dated today or yesterday, then count the dispositions applied to each message by TLD (".com", ".org", etc): |
| + | |
| + | <nowiki>export LC_ALL=C; \ |
| + | mydate=$(date "+%Y-%m-%d")\|$(date -d "yesterday" "+%Y-%m-%d"); \ |
| + | cat -v $(find /var/log/qpsmtpd -ctime -1 -type f) |tai64nlocal |egrep $mydate | grep -v ^# | \ |
| + | awk -v date="$mydate" -v tots=" {{Total}} " -F"[\t]" ' \ |
| + | /logterse plugin/ {split($4,ss,"."); ssn=0; for (i in ss) { ssn++}; \ |
| + | sendtld=tolower( ss[ssn]); sub(">","",sendtld); \ |
| + | tld=sprintf("%-20s",sendtld); plugin=sprintf("%-35s",$6); \ |
| + | plugint=sprintf("%35s%-20s",$6" ","{Total}");\ |
| + | countem=plugin tld; count[countem]++; count[plugint]++; count[tots]++; } \ |
| + | END \ |
| + | {ORS=""; print "Subject: Email Disposition on " date "\n\n\ |
| + | Denying plugin or \"queued\" TLD Count Pct\n\ |
| + | ================================= ==================== ======= =====\n"; \ |
| + | for (j in count) { pct=sprintf("%2.1f",(count[j]/count[tots])*100); \ |
| + | j ~ /Total/ ? myORS= " (" pct "%)\n": myORS="\n"; \ |
| + | printf "%s%9s%s",j,count[j],myORS |"sort -b" } }' |
| + | </nowiki> |
| | | |
| ---- | | ---- |