🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #8308

Re: News usage programs

#8308
From: Jack Bryans
Date: Thu, 06 Jun 1996 00:00
59 lines
2084 bytes
In article <31B490FB.7DE1@tornado.es.dupont.com> "Scott C. Walker"
<walkersc@tornado.es.dupont.com> writes:

> I'm looking for a program that will show me who is using my server the
> most, what groups are being accessed the most, etc.

The following perl script, cumegrps.pl, maintains a list of groups read via
nntp, sorted by frequency.

To use, edit the path to perl and to the newslogs at the top, and the path
to mail toward the bottom, and install as executable in say, /usr/local/etc.
Then add |"/usr/local/etc/cumegrps.pl" to your usenet alias.

You may have to pre-create /var/log/news/groups.read, and/or change its
owner or group, or chmod 0666 it, depending on how your mail works.

#!/usr/local/bin/perl

$cume = "/var/log/news/groups.read";

while(<>) {
    next until /^Subject:/;
    last if /Daily Usenet report/;
    seek(STDIN,0,2);
    exit;}

exit if eof;

while(<>) { last if /\(by newsgroup\)/; }

exit if eof;

if (open(CUME,"$cume")) {
    while(<CUME>) {
	($grp,$cnt) = split;
	$stats{$grp} = $cnt;}}

while(<>) {
    last if /^\s$/;
    ($grp,$cnt) = split;
    $stats{$grp} += $cnt;}

open(CUME,"> $cume")  ||
    exec( "/usr/sbin/Mail -s \"failed to create $cume\" usenet < /dev/null" );

foreach $key (sort by_value keys %stats) { write(CUME); }
close(CUME);

format CUME =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @######
$key,$stats{$key}
..

sub by_value { $stats{$b} <=> $stats{$a}; }

Jack

Technical Details
Message-ID: <2h4toprcmm.fsf@wren.acs.csulb.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <31B490FB.7DE1@tornado.es.dupont.com>

Show Full Headers
Complete Article Headers
Message-ID: <2h4toprcmm.fsf@wren.acs.csulb.edu>
Subject: Re: News usage programs
Date: Thu, 06 Jun 1996 00:00:00 +0000
From: jbryans@csulb.edu (Jack Bryans)
References: <31B490FB.7DE1@tornado.es.dupont.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 158689458
Distribution: inet
Sender: jbryans@wren.acs.csulb.edu
Organization: Cal State Long Beach
Newsgroups: news.software.nntp