LSTSRV-L Archives

LISTSERV Site Administrators' Forum

LSTSRV-L

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Marty Hoag <[log in to unmask]>
Wed, 2 Oct 1991 10:41:19 CDT
text/plain (208 lines)
On Wed, 2 Oct 1991 09:11:25 EDT Lisa M. Covi said:
>
>3. This same user wants statistics on how many requests each file on her
>filelist gets and how many requests for information on all files?
>
   We have modified the user edit LSV$GETQ EXEC to log each successful
file request.  Below are the changes we have made.  I think you'll be able
to see how they fit into the exising EXEC.  Data is stored by the year and
month requested (ie. in files called   LSGET LOGyymm  ).
 
   I have been meaning to write a general statistical command but haven't
done it.  What I have done is write special privileged commands so the
data owners can get a list of what files were requested and by whom.
I consider that information confidential between the owner of the data
and the requestor so I don't make it generally available.  But it would be
easy to issue statistics WITHOUT the destinations that might be public.
 
   I'll include one of these execs at the end.  The following entry in
the LOCALCMD FILE file on LISTSERV enables it:
/NDECHUM 4 NDECHUM
to the authorized data owner just sends the command
 
/NDECHUM            for month to date info   or
/NDECHUM LOGyymm    for a specific month.
 
   The exec at the end will probably need work before it will run at your
site...  It is offered as is with no promises!  ;-)
 
            Marty
 
--------------------------------------------------------------------------
 
Additions to LSV$GETQ to create an entry for each file requested.
I think I have everything.  We set up a new disk
(4F0, mode G) and added it to LOCAL SYSVARS as well as using it here.
 
...   Separates the sections of code in LSV$GETQ   ...
 
...
/* The following code is yours to configure */
 
/* NDSU mgh Log Definitions... */
logdate=date('S')
logtime=time()
logfn = 'LSGET'
logft = 'LOG'substr(logdate,3,4)      /* LOGyymm  */
logfm = 'G'                           /* Log Disk */
 
...
 
/* Otherwise it's ok */
 Signal Ok
 
Ok:
 /* NDSU MGH 01/24/90 Add log record... */
 
 call logit logdate logtime left(filelist,8) left(fn,8) left(ft,8) ,
            format(#blocks,8,0) destination origin strip(userdata)
 
 Exit 0 userdata
 
...
 
LOGIT:    /* Log Record    NDSU MGH 01/24/90 */
 
 parse arg logitarg
 
 'EXECIO 1 DISKW' logfn logft logfm '(FINIS VAR LOGITARG'
 logrc=rc
 if logrc<>0 then do
    say 'LSV$GETQ ERROR Writing to' logfn logft logfm '  EXECIO rc='logrc
    say 'LSV$GETQ Data="'logitarg'"'
 end
 
 return logrc
 
-------------------------------------------------------------------------
 
   Here is an example of a local /NDECHUM command - to list files in a
certain filelist.  NOTE:  Some lines were wrapped - I tried to "FIX" them
but the exec may need work as is before it will run!
 
 
/**********************************************************************
 *                                                                    *
 *  NDECHUM - Compile log of ECHUM-L files for certain users.         *
 *                                                                    *
 *  Syntax:   /NDECHUM <filetype>  (filetype defaults to current      *
 *                                  LOGyymm file).                    *
 *  Marty Hoag  NDSU Computer Center  9/24/90   11/08/90              *
 *              Adapted from NDKIDS  06/02/91 mgh                     *
 **********************************************************************/
 'GLOBALV SELECT LISTSERV GET POSTMASTER NODE RSCS MAILER';
 
 myname='/NDECHUM'
 
 debug=0
 debuglimit=20  /* Number of output records to produce */
 maxrecs=10000
 
 okorigin=' USERID@NODE',
          ' [log in to unmask],     /* Etc... Authorized User List */
          ||' 'POSTMASTER' '
 logfn='LSGET'
 logdate=date('S')  /* Current date for default type */
 logft='LOG'substr(logdate,3,4)  /* LOGyymm */
 logfm='G'    /* See LSV$GETQ for details... */
 
 targlist='ECHUM-L '          /* Filelist name */
 targllen=8
 targname='*'
 targnlen=0
 targtype='*'
 targtlen=0
 Address COMMAND;
 'MAKEBUF';
 
 parse arg origin . text ;
 
 parse var origin orgid'@'orgnode
 if orgnode = '' then orgnode = '*';
 
 if debug then say myname 'Called from "'origin'" with "'text'"'
 
 if pos(' 'translate(origin)' ',okorigin)=0 then do
    call LSVTELL origin, 'Sorry, you are not authorized to use' myname
    call LSVTELL origin, 'For more information contact' word(postmaster,1)
    if debug then say 'okorigins="'okorigin'"'
    exit 8
 end
 
 if text<>'' then logft = strip(translate(word(text,1)))
 
 logfile = logfn logft logfm
 'SET CMSTYPE HT'
 'STATE' logfile
 src=rc
 'SET CMSTYPE RT'
 if src<>0 then do
    call LSVTELL origin, 'ERROR:' myname 'file' logfile 'not found.'
    exit 4
 end
 
 countin=0
 countout=0
 nqd = queued()
 rrc=0
 if debug then say myname':  Start Search' date() time()
 
 do inrecs=1
 
    'EXECIO 1 DISKR' logfile '(VAR RECIN'
    rrc=rc
    if rrc=2 then leave  /* End of file */
    if debug & countout>=debuglimit then leave
    if rrc<>0 then do
       say 'Error in DISKR in' myname'.  rrc='rrc
       call LSVTELL origin, 'ERROR: Error reading' logfile ', rc='rrc
       'FINIS' logfile
       'DROPBUF'
       exit 8
    end
    if inrecs>maxrecs then do
       call LSVTELL origin, myname 'ERROR:  Maximum Record Count Exceeded. ' ,
'Contact' word(postmaster,1)
       call LSVTELL origin, '                 Countin='countin ,
'Countout='countout 'inrecs='inrecs'.'
       'FINIS' logfile
       'DROPBUF'
       exit 8
    end
 
    countin = countin + 1
    parse var recin filedate filetime filelist filename filetype filesize ,
                    filedest filereq .
    if   (targllen=0 | left(filelist,targllen)==targlist) ,
       & (targnlen=0 | left(filename,targnlen)==targname) ,
       & (targtlen=0 | left(filetype,targtlen)==targtype) ,
      then do
       if countout=0 then do  /* headers */
 
          queue '* File     File     Date   K-Bytes  Destination'
          queue '* Name     Type          (to next 4k) '
          queue '*------* *------* *------* *------*' ,
'*--------------------------*'
       end
       /* Try to keep outrec<=80 bytes... first 3 + sp = 3x9 = 27 */
       outrec=left(filename,8) left(filetype,8) left(filedate,8) ,
right(filesize,8)
       outrec=outrec' 'strip(right(filedest,80-length(outrec) ))
       queue outrec
       countout=countout+1
    end
 
end inrecs
 
if debug then say myname':  Ended Search' date() time()
'FINIS' logfile
call LSVTELL origin, myname 'Complete. ' countout 'records selected from' ,
countin 'in' logfile'.'
 
if countout>0 then do
   Call LSVMAIL origin,,myname 'of 'logfile,queued()-nqd
end
 
 'DROPBUF';
 exit 0;

ATOM RSS1 RSS2