サポートと今すぐチャット
サポートとのチャット

Foglight for Infrastructure 7.1.0 - 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

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.

Building a pattern that matches multiple characters

Using regular expressions you can define a pattern to match a multi-character pattern. For example, you can write a regular expression to match all hosts whose names contain Host and are followed by exactly two digits. That means you want to match the following strings:

But not:

The expression that matches this pattern is: Host[0-9][0-9].

Going further, you can write an expression that matches all hosts whose names contain Host, followed by exactly two digits, and optionally a lowercase letter. That means you want to match the following strings:

But still not:

The expression that matches this pattern is: Host[0-9][0-9][a-z]?.

Using advanced quantifiers

In addition to asterisk ‘*’ and question mark ‘?’, there are additional quantifiers that are supported in regular expressions:

The plus sign ‘+’ means one or more times. For example, case[0-9]+ matches case1, case12345, but not simply case.
{3} occur exactly three times.
{2,4} occur at least two times and as many as four times.
{3,} occur at least three times up to infinity.
関連ドキュメント

The document was helpful.

評価を選択

I easily found the information I needed.

評価を選択