HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/doc/analog/examples/ftplog2commonlog
#!/usr/bin/perl
#
# Convert ftp logs to common log format so they can be processed by 
# standard web log processing software.
#
# Ftplog2Commonlog v. 1.0 is copyright 1995, 1996, 1997, 2000 by Joey Hess.
# May be distributed under the terms of the GPL.
#
# Usage:
# 	ftplog2commonlog < logfile
#

# Get the timezone offset. Needs a fairly new date command.
my $date=`date -R`;
($tzoffset)=$date=~m/( [+-]?\d+)$/;

while (<>) {
	($mon,$mday,$time,$year,$host,$size,$filename)=m/.*?\s+(.*?)\s+(\d+)\s+(.*?)\s+(\d+)\s+.*?\s+(.*?)\s+(\d+)\s+(.*?)\s+/;
	if (length($mday) == 1) { $mday="0$mday" }
	if (length($mon) == 1) { $mon="0$mon" }
	print "$host - - [$mday/$mon/$year:$time$tzoffset] \"GET $filename HTTP/1.0\" 200 $size\n";
}