Common Glob Patterns
Glob patterns specify sets of file names with wildcard characters. When you configure the Tetra File-Log Agent File Watcher Service, you can use glob patterns to monitor specified paths and detect changes in either certain files or folders.
IMPORTANT
It's recommended that you test your glob patterns by using a web application such as Glob tester before configuring them in the Tetra File-Log Agent.
Glob Pattern Syntax
The Tetra File-Log Agent supports the following glob syntax:
Patterns | Description |
---|---|
* | matches any number of characters including none, excluding directory separator |
** | match zero or more directories |
? | matches a single character |
/ -or- \ | path separators |
[abc] | matches one character in the brackets |
[!abc] | matches any character not in the brackets |
{abc,123} | comma-delimited set of literals, matched 'abc' or '123' |
NOTE
For alphabetical characters, only the standard 26 characters of the Latin alphabet are supported. Any alphabetical characters that aren't part of the standard Latin alphabet will cause data duplication.
Glob Pattern Examples
In the following examples, the path
defined in the config.json
is C:\temp\Source
.
Searching Folders
Pattern: *
Description: Return all of the folders at the current folder path (C:\temp\Source)
Pattern: A*
Description: Return all of the folders at the current folder path (C:\temp\Source)
with the folder name starting as A
Pattern: */*
Description: Return all of the folders at the first level under the current folder path (`C:\temp\Source`)
Pattern: */*/*
Description: Return all of the folders at the second level under the current folder path (`C:\temp\Source`)
Pattern: Logs
Description: Get a specific folder `Logs` at the current folder path (`C:\temp\Source`)
Patterns: **
Description: Return all of the folders recursively under the current folder path
by traversing down the current folder path (`C:\temp\Source`)
Pattern: **/AuditTrail
Description: Return all of the folder named as `AuditTrail`
by traversing down the current folder path (`C:\temp\Source`)
Pattern: **/*AuditTrail*
Description: Return all of the folder named as `AuditTrail`
by traversing down the current folder path (`C:\temp\Source`)
Pattern: AuditTrail/2020-06-07
Description: Return the exact folder, `C:\temp\Source\AuditTrail\2020-06-07`
NOTE
When using the Folder Mode for File Watcher Service, if the pattern is empty, the Agent will monitor the path itself.
Searching Files
Pattern: *.txt
Description: Return all of the files with extension as txt at the current folder path (`C:\temp\Source`)
Pattern: .{log,txt}
Description: Return all of the files with file extension either as .log or .txt at the current folder path (`C:\temp\Source`)
Pattern: info*.txt
Description: Return all of the files with the name starting with `info` at the current folder path (`C:\temp\Source`)
Pattern: info?.txt
Description: Return all of the files with the name starting with `info` and only has one character after that at the current folder path (`C:\temp\Source`). Same examples: info2.txt, infoz.txt
Pattern: info[123a].txt
Description: Return all of the files with the file name starting with `info` and only has one character after that. The matched character is among the characters of `1`, `2`, `3` or `a`.
Pattern: info[!123a].txt
Description: Return all of the files with the file name starting with `info` and only has one character after that. The matched character is not any of the characters of `1`, `2`, `3` or `a`.
Pattern: [!~]*.txt
Description: Return all of the files with file extension as txt and the file name doesn't start with ~.
This pattern can be used to exclude the temp files generated by the Windows.
Pattern: **/*
Description: Return all of the files
by traversing down the current folder path (C:\temp\Source)) recursively
Pattern: **/EVO
Description: Return all of the files with file name starting with `EVO` by traversing down the current folder path (C:\temp\Source)) recursively
Pattern: **/*EVO*
Description: Return all of the files with file name containing `EVO` by traversing down the current folder path (C:\temp\Source)) recursively
Pattern: **/{EVO,LOG,ERROR}*
Description: Return all of the files with file name starting with `EVO`, `LOG`or `ERROR`, by traversing down the current folder path (C:\temp\Source)) recursively
Updated 4 months ago