Common Glob Patterns

Overview

Glob patterns implemented in the Tetra File Log Agent provide methods to traverse the file system and return files or the folder that matches a defined set of glob patterns.

The following pattern rules are accepted in the Tetra File-Log Agent:

PatternsDescription
*matches any number of characters including none, excluding directory separator
**match zero or more directories
?matches a single character
/path separators
(Please note that backslash is not supported as 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'

📘

Case insensitive

In current versions of the File Log Agent (up to and including 4.2) the only alphabetical characters which are supported within file paths are the standard 26 characters of the Latin alphabet. Any alphabetical character beyond these will cause undesirable duplication of data.

Testing glob patterns

You can test your glob patterns via web apps such as Glob tester.

Common usage Samples

In the following examples, the path defined in the config.json is C:\temp\Source.

Searching Folder

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 File

Pattern: 		 *.txt	
Description: Return all of the files with extension as txt  at the current folder path (`C:\temp\Source`)

Pattern:     .{log,txt}
Description: Rreturn 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 expamples: 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 travsing down the current folder path  (C:\temp\Source)) recursively

Pattern:     **/*EVO*
Description: Return all of the files with file name containing `EVO` by travsing 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 travsing down the current folder path  (C:\temp\Source)) recursively