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

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

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.

Using special characters and regular expression flags

Special characters in regular expressions the regular expressions further extend their flexibility in advanced use cases.

The caret ‘^’ reverses the meaning of a regular expression element. For example, [^KLM] matches a single character that is not K, L, or M.
A backslash ‘\’ followed by a lowercase ‘w’, \w, means a word character (an alphanumeric character or an underscore ‘_’). It has the same meaning as [a-zA-Z_0-9].
A backslash ‘\’ followed by a lowercase ‘s’, \s, means a white space character. It has the same meaning as [\t\n\x0b\r\f].
The flag (?i) makes the regular expression case insensitive. In Foglight for Infrastructure, the Add OS Monitor wizard uses this flag in the Resource Mapping regular expression. For example: (?i).*host.*.
The flag (?x) allows you to add comments to explain a complex or unusual pattern. The comment starts with a number sign ‘#’. For example: (?x)[KLM]:.* # We dislike drives K through M.

Grouping elements in a pattern

The regular expression syntax provides a way to group elements together and use groups together with other operators, as required.

For example, to match the above group ((\\.[A-Za-z]+)) zero or more times, write (\\.[A-Za-z]+)*.
For example, to use a prefix that is either dev or prod, write (dev|prod).
相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级