Lasso Soft Inc. > Home

[log_clf]

Linklog_clf
AuthorJason Huck
CategoryUtility
Version8.x
Licensehttp://opensource.org/licenses/artistic-license.php
Posted21 Dec 2005
Updated16 Jan 2006
More by this author...

Description

This tag was co-written with Alex Pilson, and was designed to give the developer more control over access logs. Potential uses include writing logs only for specific pages (i.e. to supply to advertisors) or controlling the url that gets logged (for instance, with one-file type systems that do not use a url-rewriting scheme, where otherwise all your log entries would be for /index.lasso). Writes in Apache Combined Log Format.

Requires the path to the log file and optionally accepts a custom filename. (Otherwise uses [response_filepath].)

For accurate bytes logging, must be called via [define_atend]. (see example)

Sample Usage

	define_atend({
		log_clf( -path='/access.txt');
	});

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag(
	'clf',
	-namespace='log_',
	-required='path',
	-type='string',
	-optional='filename',
	-type='string',
	-priority='replace',
	-description='Writes page stats to a file in Apache Combined Log Format.'
);	
	local(
		'username' = (client_username ? client_username | '-'),
		'protocol' = $__http_header__->split('\r\n')->get(1)->substring(1,8),
		'status' = $__http_header__->split('\r\n')->get(1)->substring(10,3),
		'content_length' = bytes($__html_reply__)->size,
		'timestamp' = date->format('[%d/%b/%Y:%T %z]'),
		'referrer' = (referrer_url == '' ? '-' | referrer_url),
		'cookies' = (client_cookielist ? ('"' + client_cookielist + '"') | '')
	);
	
	!local_defined('filepath') ? local('filepath' = response_filepath);		
	
	log(#path);			
		client_ip + ' - ' + #username + ' ' + #timestamp + ' "' + client_formmethod + ' ' 
			+ #filepath + ' ' + #protocol + '" ' + #status + ' ' + #content_length + ' "' 
			+ #referrer + '" "' + client_browser + '" ' + #cookies + '\n';
	/log;	
/define_tag;

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft