Use event filters to control when a Serv-U event is triggered. By default, 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 event may trigger an email each time a file is uploaded to the server. However, by using an event filter, events can be triggered on a more targeted basis. For example, you can configure a File Uploaded event to only send an email when the file name contains the stringimportant, so an email would be sent when the fileImportant Tax Forms.pdfis uploaded but not when other files are uploaded to the server. Additionally, you can configure a File Upload Failed event to run only when the FTP protocol is used, not triggering for failed HTTP or SFTP uploads. You can do this by controlling the variables and values related to the event and by evaluating their results when the event is triggered.
Event filter fields
Each event filter has the following critical values that must be set:
l Name: This is the name of the filter, used to identify the filter for the event. l Description (Optional): This is the description of the event, which may be
included for reference.
l Logic: This determines how the filter interacts with other filters for an event. In
most cases, AND is used, and all filters must be satisfied for the event to trigger. The function of AND is to require that all conditions be met. However, the OR operator can be used if there are multiple possible satisfactory
responses (for example, abnormal bandwidth usage of less than 20 KB/s OR greater than 2000 KB/s).
l Filter Comparison: This is the most critical portion of the filter. The Filter
Comparison contains the evaluation that must occur for the event to trigger. For example, a filter can be configured so that only the useradmintriggers the event. In this case, the comparison isIf $Name = (is equal to) admin, and the data type isstring. For bandwidth, either an unsigned integer or double precision floating point value is used.
Event filters also support wildcards when evaluating text strings. The supported wild- cards include:
l *- The asterisk wildcard matches any text string of any length. For example: l An event filter that compares the$FileNamevariable to the string
data*matches files nameddata,data7,data77,data.txt,
data7.txt, anddata77.txt.
l ?- The question mark wildcard matches any one character, but only one
character. For example:
l An event filter that compares the$FileNamevariable to the string
data?matches a file nameddata7but notdata,data77,data.txt,
data7.txt, ordata77.txt.
l An event filter that compares the$FileNamevariable to the string
data?.* matches files nameddata7anddata7.txtbut notdata,
data77,data.txt, ordata77.txt.
l An event filter that compares the$Name variableto the stringA????
l []- The bracket wildcard matches a character against the set of characters
inside the brackets. For example:
l An event filter that compares the$FileNamevariable to the stringdata
[687].txtmatches files nameddata6.txt,data7.txtand
data8.txtbut notdata5.txt.
l An event filter that compares the$LocalPathNamevariable to the string
[CD]:\*matches any file or folder on theC:orD:drives. You can use multiple wildcards in each filter. For example:
l An event filter that compares the$FileNamevariable to the string
[cC]:\*.???matches any file on theC:drive that ends in a three letter file extension.
l An event filter that compares the$FileNamevariable to the string?:\*Red
[678]\?????.*matches a file on any Windows drive, contained in any folder whose name containsRed6,Red7orRed8, and that also has a five character file name followed by a file extension of any length.
Event filters
Event filters are used by comparing fields to expected values in the Event Filter menu. The best example is raising an event only when a certain user triggers the action, or when a certain file is uploaded. For example, an administrator may want to raise an email event when the fileHourlyUpdate.csvis uploaded to the server, but not when other files are uploaded. To do this, create a new event in the Domain Details > Events menu. The Event Type is File Uploaded, and on the Event Filter tab a new filter must be added. The$FileNamevariable is used and the value is
HourlyUpdate.csvas shown below:
As another example, it may be necessary to know when a file transfer fails for a specific user account. To perform this task, create a new File Upload Failed event, and add a new filter.
The filter comparison is the$Namevariable, and the value to compare is the user name, such asProductionLineFTP:
You can also filter for events based on specific folders using wildcards. It may be necessary to trigger events for files uploaded only to a specific folder, such as when an accounting department uploads time-sensitive tax files. To filter based on a folder name, create a new File Uploaded event in the Domain Details > Events menu, and set it to Send Email. Enter the email recipients, subject line, and message content, and then open the Event Filters page. Create a new event filter, and add the filter comparisonIf $LocalPathName = (is equal to)
C:\ftproot\accounting\*with the type of(abcd) string. This will cause the event to trigger only for files that are located withinC:\ftproot\accounting\.