Consulting services available.
Further support on www.tinaja.com/info01.html
(The following is believed correct. Please report any errors or differing experiences.)
% This is yet another
example of PostScript-as-language applied
% to solving real world problems. These particular routines read
% an extended virtual log file and rewrite it in PostScript friendly
% format for a single client. A filtered list of referrals is also
% generated.
% Arrangements have to be made with your ISP to get a copy of the
% current log file resident on your local host.
% The Microsoft Server extended file format is based on one ASCII
% line per hit, with each field of that line delimited by ", "
% A format example might be...
% 00 mirrorii-fzp0-ptx.alabama.net, client ip address
% 01 -, client
username
% 02 2/2/98, date
% 03 0:04:17, time
% 04 W3SVC, service
% 05 TOWER4, computer
name
% 06 www.Pepperoni.com, IP
address of server
% 07 311,
processing time in msec
% 08 225, bytes
received
% 09 2494, bytes
sent
% 10 200,
service status code
% 11 0, windows
NT status code
% 12 GET, target
of operation
% 13 /Default.htm, requested
file
% 14 Mozilla/3.0.... (Win95; U), client system
% 15 http://www.r.....htm, client
referral
% 16 -, unused?
% 17 -, unused?
% field numbers have been added to the beginning of each example
% above; they are NOT in the actual file listing.
% The GENERAL PROCEDURE for using PostScript-as-language
is as
% follows:
% (1) Carefully READ the entire file inside your favorite
% WP or Editor as an ASCII textfile.
%
% (2) Carefully MODIFY the filenames and variables and such
% so they apply to you.
%
% (3) SAVE the modified code AS A STANDARD ASCII TEXTFILE using
a unique filename.
%
% (4) RUN the modified code by dragging and dropping it into
% Acrobat Distiller. GhostScript may alternately
be used.
%
% (5) TEST, INTERPRET, and MODIFY your results.
%
%%%%%%%%%%%% (A) INSTALL AND RUN GONZO UTILITIES %%%%%%%%%%%%%%%%%%
% This optionally uses my gonzo utilities from
% http://www.tinaja.com/psutils/gonzo20.ps
% (C:\\windows\\desktop\\gonzo\\gonzo.ps) run % run the gonzo utilities
% gonzo begin %
activate the gonzo utilities
% ps.util.1 begin
% % printerror
% nuisance begin
%%%%%% (B) FORMAT EXTENDED LOG FILE INTO POSTSCRIPT ARRAYS %%%%%%%
/rawlogfilename (C:\\windows\\desktop\\Zeketo~1\\full.log) def
/fmtlogfilename (C:\\windows\\desktop\\Zeketo~1\\cust.log) def
/reflogfilename (C:\\windows\\desktop\\Zeketo~1\\refer.log) def
/sourcefile rawlogfilename (r) file def %
create files
/targetfile fmtlogfilename (w) file def
/referfile reflogfilename (w) file def
/str 1000 string def /delim (, ) def %
delimiter
/logelementcount 18 def %
expected valid log fields
/serverfilename (www.tinaja.com) def %
customer web site
/refexcludeif
%
self-referrals to exclude [(tinaja)(inaja)(TINAJA)(file:)] def %
also local bookmarks
% /writecurmat writes the current customer log file line to targetfile
% in a "PostScript friendly" array-of-strings format...
/writecurmat { targetfile (\n [ ) writestring % start array
curmat { targetfile (\() writestring %
start paren targetfile
exch writestring %
write filename
targetfile (\)) writestring } forall %
end paren repeat
targetfile ( ]\n) writestring %
end array
} def
% /extractarray converts the log text line into an array of strings...
/extractarray {
mark curline 30 {delim search {exch pop exch}{ exit} ifelse }
repeat
pop ]
/curmat exch store % save matrix
curmat length logelementcount eq { %
valid # of entries?
curmat 6 get serverfilename eq %
valid customer?
{writecurmat reportref} if } if % yes, report } def
%%%%%%%%% (C) REFERRAL FILTER AND REPORTER %%%%%%%%%%%%%%%%%%
% /reportref filters the referrals and reports only the chosen
ones
% to referfile. At present, all filtered referrals are reported;
% they can later easily be ranked and duplicates counted, etc...
/reportref { true % assume valid
% filter for your self-references
refexcludeif {/cursearch exch store curmat 15 get cursearch search
{pop
pop pop pop false}{pop} ifelse } forall
% remove any search engine by assuming a (?) character in it...
curmat 15 get (?) search %
false if an engine
{pop pop pop
pop false}{pop} ifelse
% remove blank hits by eliminating short ones...
curmat 15 get length 3 lt {pop false} if % no dashes
% and report valid remaining referrals (not host, engine, or (-))
{curmat 15 get referfile exch writestring %
write referral referfile
(\n) writestring } if %
and cr
} def
%%%%%%%%%%%% (D) MAIN SUPERVISORAY SCAN CODE %%%%%%%%%%%%%%%%%%%%%%%%%%
% /processrawlogline is a supervisory proc that saves the line
% and then converts it to a PostScript friendly array of strings...
/processrawlogline {/curline exch store extractarray} def
% /scaninput reads the raw log file a line at a time and processes it...
/scaninput {{sourcefile str readline {processrawlogline} {processrawlogline exit} ifelse} loop } def
%%%%%%%%% (E) DEMO - REMOVE OR ALTER BEFORE REUSE %%%%%%%%%%%%
% this actually does the whole job...
% Be sure to alter the filenames above!
scaninput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright c. 1998 by Don Lancaster and Synergetics, Box 809,
% Thatcher AZ, 85552 (520) 428-4073. synergetics@tinaja.com
% All commercial rights and all electronic media rights are
% *fully* reserved. Linking welcome. Reposting is expressly forbidden.
% Consulting services avaialable
% Further support on www.tinaja.com/info01.html
%EOF
Click here for the Downloadable PostScript Sourcecode for this file.
Remember to first READ the file in an editor, MODIFY it
to match your
needs, SAVE it as an ORDINARY ASCII TEXTFILE, and
then RUN
it by dragging and dropping into Acrobat Distiller.
Please click here to...
Get a Synergetics catalog. | Send Don Lancaster email. | |
Start your own tech venture. | Pick up surplus bargains. | |
Sponsor a display banner. | Find out what a tinaja is. | |
Find research solutions. | View recommended books. | |