getserverlog(
LOGS
,
START
,
END
)

The getserverlog( function retrieves information from one or more server logs.


Parameters

This function has three parameters:

logs – this is a slash (/) separated array specifying what logs to retrieve. The available options are share/shareerror/web/weberror/webperformance.

start – log date to retrieve (if omitted, today’s date will be assumed).

end – last log date to retrieve (if omitted, the start date will be assumed).


Description

This function retrieves server log information (see Logging Server Activity). For example, this code will retrieve today’s web logs.

let loglines = getserverlog("web")

Note: Each line of the log is separated by a carriage return.

Important: This function can ONLY be used on the actual server computer, it cannot be used on a client computer. It can be run on a copy of Panorama running on the server computer, or it can actually be run in a web procedure. For example, this web procedure will display the number of web errors on the users' browser.

let loglines = getserverlog("weberror")
let errorCount = linecount(loglines)
cgiHTML = "There have been "+pattern(errorCount,"# web publishing error~")+" today."

Or, if used in a regular copy of Panorama runnning on the server computer, this code will import today’s performance logs into the current database for analysis. Note: The getserverlog( function will automatically flush the log caches before retrieving the log data.

let loglines = getserverlog("webperformance")
importtext loglines,"ExistingData","Replace"

Usually this function retrieves todays logs, but you can also specify a different date.

let loglines = getserverlog("webperformance",date("monday"))
importtext loglines,"ExistingData","Replace"

You can also specify a range of dates. This example imports all of the performance logs for the current month.

let loglines = getserverlog("webperformance",month1st(today()),today())
importtext loglines,"ExistingData","Replace"

Finally, you can also specify multiple log types. This example imports all of the error logs (both sharing and web publishing) for the past 7 days.

let loglines = getserverlog("shareerror/weberror",today()-7,today())
importtext loglines,"ExistingData","Replace"

See Also


History

VersionStatusNotes
10.2NewNew in this version.