Skip to main content
Version: 8.1

system.util.audit

This function is used in Python Scripting.

Description​

Inserts a record into an audit profile.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.util.audit([action], [actionTarget], [actionValue], [auditProfile], [actor], [actorHost], [originatingSystem], [eventTimestamp], [originatingContext], [statusCode])

Parameters​

TypeParameterDescription
StringactionWhat happened. Default is null. [optional]
StringactionTargetWhat the action happened to. Default is null. [optional]
StringactionValueThe value of the action. Default is no value. [optional]
StringauditProfileWhere the audit record should be stored. Defaults to the project’s audit profile (if specified), or the Gateway audit profile if calling in the Gateway or Perspective Session scope. [optional]
StringactorWho made the change. Will be populated automatically if omitted, assuming there is a known user. [optional]
StringactorHostThe hostname of whoever made the change. Will be populated automatically if omitted. [optional]
List[String]originatingSystemAn even-length list providing additional context to the audit event. Will be appended to the automatically generated list.
Typically, the automatically generated context looks like this:
sys:${gatewayName}:\project:${projectName}
If you provided [“component”, “Joe’sButton”, “field”, “value”], you would get a record with
originatingSystem:sys:${gatewayName}:\project:${projectName}:
\component:Joe’sButton:\field:value.
If a string is provided, this automatic context will not be used and your provided string will be written directly into the originatingSystem column in the audit profile. [optional]
DateeventTimestampWhen the event happened. Will be set to the current time if omitted. [optional]
IntegeroriginatingContextWhat scope the event originated from: 1 means Gateway, 2 means Designer, 4 means Client. Will be set automatically if omitted. [optional]
IntegerstatusCodeA quality code to attach to the object. Defaults to 0, indicating no special meaning. [optional]

Returns​

Nothing

Scope​

Gateway, Vision Client, and Perspective Session.

Code Examples​

Example #1
# All of the parameters are optional, so you're free to only provide parameters you're interested in.
# In the very least provide just the action you wish to record, which gives the function a chance to look up all of the other parameters automatically.
system.util.audit("The user did a thing!")
Example #2
# Simple example just showing parameter usage.
myAction = "The button was pressed"
myTarget = "My Button"

system.util.audit(action = myAction , actionTarget = myTarget )