config.projectName="Client/Project"
config.documentName="Subproject/Issue"

config.workdir = paste0(tempdir(),"/ex")

config.generatePercentileRankings = TRUE
config.generateTransactionDetails = TRUE
config.generateDiagnosticPlots = TRUE
config.generateGraphForTimeOver = 1000
config.generateServerSessionStats=TRUE

config.readBaseline=TRUE

config.useragent.generateFrequencies = TRUE
config.useragent.minimumPercentage = 0
config.useragent.maximumPercentile = 100
config.useragent.discardOther = FALSE

# Directory handling 
#
# By default the sampleRfile.R script will read the lexically last log file name.  
# This makes sense where logs are copied into a log diretory daily.  To change the behaviour the script 
#    has to be updated to call one of the other logFileNamesGet* functions.  
#
# following line accesses the sample log file in the package 
#
config.current.dataDir=dirname(system.file("extdata", "compressed.log", package = "WebAnalytics"))
config.current.dirNames=c(".")

# for logs in the data directory under the work directory 
#
#config.current.dataDir="."
#config.current.dirNames=c("data")

# for logs elsewhere in the filesystem, with a directory for each web server  
#
#config.current.dataDir="/working/logs"
#config.current.dirNames=c("WS1", "WS2")

# 
# use the following to read IIS logs with embedded comments that describe the file content - 
#   only the first record format comment in a file will be recognised
config.current.columnList=logFileFieldsGetIIS(logFileNamesGetLast(dataDirectory=config.current.dataDir,directoryNames=config.current.dirNames)[[1]])

# for default Apache logs with elapsed microseconds and WebSPhere JSESSIONiD on the end
#
#config.current.columnList=c("Apache", "elapsedus", jsessionid")

# the baseline directory specifications work the same eway as the current ones.   
#config.baseline.dataDir="."
config.baseline.dataDir=dirname(system.file("extdata", "compressed.log", package = "WebAnalytics"))
config.baseline.dirNames=c(".")
#
#config.baseline.columnList=c("Apache", "elapsedus", jsessionid")

# 
# use this when the baseline log format is the same as the current data log format
#
config.baseline.columnList=config.current.columnList

#
config.fix.data<-function(b) {

	if(length(grep("Apache", config.current.columnList)) > 0){
		# Apache URL contains operation and HTTP version in a quoted string, IIS does not
		b$url = sub("([^?]*)[?].*", "\\1", b$url)
		b$url = sub("[^ ]* ([^ ]*).*", "\\1", b$url)
	}
	#b$url = sub("/Restaurant/[0-9]+/", "/Restaurant/NNNN/", b$url)
	b$url = sub("/content/.*", "Static Content Requests", b$url)
	b$url = sub("/Content/.*", "Static Content Requests", b$url)
	b$url = sub("/Scripts/.*", "Static Content Requests", b$url)
	b$url = sub("/bundles/.*", "Static Content Requests", b$url)
	b$url = sub("[0-9]+$", "NNNN", b$url)
	b$url = sub(".*\\.js$", "Static Content Requests", b$url)
	b$url = sub(".*\\.gif$", "Static Content Requests", b$url)
	b$url = sub(".*\\.css$", "Static Content Requests", b$url)
	b$url = sub(".*\\.jpg$", "Static Content Requests", b$url)
	b$url = sub(".*\\.png$", "Static Content Requests", b$url)
	b$url = sub(".*\\.ico$", "Static Content Requests", b$url)
	b$url = sub(".*\\.wsdl$", "Static Content Requests", b$url)
	b$url = sub(".*\\.xsd$", "Static Content Requests", b$url)
	b$url = sub(".*\\.bmp$", "Static Content Requests", b$url)
	b$url = sub(".*\\.html$", "Static Content Requests", b$url)
	b$url = sub(".*dynaTraceMonitor.*","Monitoring", b$url)
	#b = b[b$url != "/jlink/userprof/authentication.do" & b$url != "/jlink/userprof/location.do" & b$url != "/jlink/js/confirm.html" & b$url != "/jlink/security/logout.do" & b$url != "/jlink/mainpage.do",] 
	#b = b[b$elapsed > 1000 & b$elapsed < 5000,]

	return(b)
}
