立即与支持人员聊天
与支持团队交流

Foglight for Infrastructure 5.9.5 - User Guide

Using Foglight for Infrastructure Monitoring log files with Foglight Log Monitor Monitoring IBM PowerVM environments
Before you begin Managing PowerVM HMC agents Monitoring your PowerVM environment
Advanced system configuration and troubleshooting Reference
Foglight for Infrastructure views Foglight Log Monitor views Rules Metrics
Appendix: Building regular expressions in Foglight

Where can I find regular expressions?

Regular expressions can be found in many parts of Foglight. For example, credential mappings use the regular expression syntax to select the hosts accessible with a specific credential.

The Excluded Drives property of the WindowsAgent is another example of a regular expression usage in Foglight.

In addition, regular expressions can be found in LogFilter expressions, FxV Hit Analysis, and other parts of Foglight.

Regular expression basics

The simplest regular expression is a basic text string containing only alphanumeric characters. For example, Host1, matches the same value, Host1.

A regular expression is fundamentally different from a pattern using file name wild cards such as an asterisk ‘*’ or a question mark ‘?’. For example, issuing a search in Windows® Explorer using *.jpg as a filter matches all files with the .jpg extension.

This is not a regular expression, it is a simple filter that uses wild cards. An equivalent regular expression that selects all files with the .jpg extension is .*\\.jpg. The details of this regular expression are covered next.

For more details, see these topics:

Building a simple pattern

In this section we look at a simple regular expression pattern that selects all hosts whose names start with Host. The completed expression is Host.*. This expression contains two special characters:

The final expression, Host.*, results in matching any strings that start with Host and match any of the following host names:

However, the following host names do not match this expression:

We now take a look at a simple pattern that matches a group of similar text strings. A common pattern for selecting Windows® drive names is C:.*. A typical usage of this expression is in the Excluded Drives property of the WindowsAgent.

Unlike in a simple file matching filter, C:*, the equivalent regular expression requires a period between the colon ‘:’ and the asterisk ‘*’: C:.*.

Next, we build a regular expression that selects all hosts whose name include the string Host, not just the ones that start with Host. To do that, simply add a prefix to the above expression, Host.*, resulting in .*Host.*.

This expression matches any hosts that include Host, but not necessarily begin with it. That is because the prefix .* translates to any combination of zero or more characters appearing before the string Host. The expression matches each of the following host names:

DBHost-9000, but not DBHst-9000

Building a pattern that matches a specific character

A regular expression pattern can be used to match a string that includes a specific character. For example, you can build a pattern that matches only the drive letters C through H. To do this, you have two options:

Choosing the second option, the resulting regular expression is: [C-H]:.*. This means, any letter in the range and including ‘C’ through ‘H’, followed by a colon ‘:’, and optionally by more characters.

相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级