Formatting Plain Text Logs ā
Regex with named capturing groups ā
To filter non JSON Log Lines for certain parts you have to use a regex pattern with named capturing groups.
Lets take (?P<group_name>...) as an example. P<group_name> assigns the name group_name to the group. The part inside the parentheses (...) is the pattern to match.
Then you can insert the {group_name} into your custom message template.
Example Log Line from audiobookshelf:
txt
[2025-05-03 10:16:53.154] INFO: [SocketAuthority] Socket VKrcSNa--FjwAqmSAAAU disconnected from client "example user" after 11696ms (Reason: transport close)Regex & Template:
yaml
containers:
audiobookshelf:
keywords:
- regex: '(?P<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}).*Socket.*disconnected from client "(?P<user>[A-Za-z\s]+)"'
template: '\nš The user {user} was seen!\nš {timestamp}'
hide_regex_in_title: true # Hide regex in notification title for a cleaner lookResult:
Normal notification and notification with template and hide_regex_in_title:

TIP
You can add the key original_log_line to your template to add the full log entry to your notification message.