%!PS % Webfile 404 snooper snoop_404.1.psl % ======= % Copyright c 9/2017 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 2.1 % This is the start of a series of 404 web log analysis utilities. % The initial goal is to create an array of report line starting points. % To use the Gonzo utilities, code MUST be run from the Windows Command Line % as in "//acrodist /F" to allow disk writes and reads. (C:/Users/Don/Desktop/Ghost/gonzo.psl) run % activate the gonzo utilities /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def guru % activate the gonzo utilities. /usegrid {100 200 10 setgrid % draw a 20x20 green box example 20 20 showgrid} store usegrid % ======================= 404 reporting code begins here ======================= % define companion files... /weblogfiledirectory (C:/Users/don/Desktop/web/) store /weblogfilename (moo.tinajacom) store /weblogfile weblogfiledirectory weblogfilename mergestr store weblogfile == % verify input file location % optional do a trial read... /readfile weblogfile (r) file store % establish input read file /currentfileposn 0 store % 0 1 300 {readfile exch setfileposition readfile read % { } {exit} ifelse } for % generate list of linefeed positions... %% optional find length of readfile %%%%%%%%%%%%%%%%%%% readfile 0 setfileposition 0 0 1 10000000 { pop readfile read {pop 1 add dup dup 1 sub /howlong exch store % ioerror on exit otherwise readfile exch setfileposition }{ exit} ifelse } for howlong == % report length of log file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /readfile weblogfile (r) file store % reestablish input read file ? /currentfileposn 0 store readfile 0 setfileposition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /moreprocessing { pre (") search { pop /quo exch store /pxxx exch store} { (gotabigproblem) == } ifelse quo pxxx mergestr fof mergestr == } store /totallines 0 store /processstring {/curline exch store /totallines totallines 1 add store curline ( 404 ) search { /pre exch store /fof exch store pop moreprocessing } {pop } ifelse } store 0 1 100000 { pop readfile 15000 string readline % needed to unchoke Russian hackers! % 2 copy == == readfile fileposition == (\n) print {processstring}{exit} ifelse} for (\nTotal processed lines ae ) print totallines == showpage % nothing to show, really. Read your log file instead. % EOF