Event Filtering In Serv-U - KB Article #2001Related Articles --
Serv-U Event Filters allow administrators to control to a greater degree when a Serv-U event is triggered. By default, Serv-U Events trigger each time the Event occurs. The Event Filter allows events to be triggered only if certain conditions are met. For example, A standard Serv-U Event might trigger an email each time a file is uploaded to the server. However, using an Event Filter, Events can be triggered on a more targeted basis. A "File Uploaded" event can be configured to only send an email when the file name contains the string "important", so an email would be sent when the file "Important Tax Forms.pdf" is uploaded but not when random other files are uploaded to the server. Additionally, a "File Upload Failed" Event could be set to run only when the protocol used is "FTP", not triggering for failed HTTP or SFTP uploads. This is done by controlling the various variables and values related to the Event and evaluating their results when the Event is triggered.
Event Filter Fields
Each Event Filter has three critical values that must be set:
- Name - This is the name of the filter, used to identify the Filter for the Event.
- Description (Optional) - This is the description of the event, which may be included for reference.
Using Event Filters
Event filters are utilized by comparing fields to expected values in the Event Filter menu. The best example is firing an Event only when a certain user triggers the action, or when a certain file is uploaded. For example, an administrator may wish to fire an email event when the file "HourlyUpdate.csv" is uploaded to the server, but not other files. To do this, a new Event can be created in the "Domain Details | Events" menu. The Event Type is "File Uploaded", and in the "Event Filter" tab a new filter must be added. The $FileName variable is used and the value is HourlyUpdate.csv as shown below:
As another example, it might be necessary to know when a file transfer fails for a specific user account (perhaps one used by an automated process). To perform this task, create a new "File Upload Failed" event and add a new Filter. The filter comparison will be "$Name", and the value to compare would be the username, such as ProductionLineFTP:
Wildcards can be used to extend the usefulness of string comparison and find out whether one string contains another string. For example, if a "File Uploaded" Event should only be triggered if a file is uploaded to D:\ftpfiles\mycustomer, you can use the Event Filter:
If $LocalPathName equals D:\ftpfiles\mycustomer\*
In this way, not only can strings be compared for exact similarity but also for inclusion exclusion of certain strings.