May 2019
Intermediate to advanced
442 pages
11h 36m
English
To configure mtail, we require a program with the pattern matching logic. Let's look at a very straightforward example available in the official repository:
# simple line countercounter line_count/$/ { line_count++}
This program defines the line_count metric of the counter type, an RE2-compatible expression /$/ matching the end of a line, and finally, an action between { }, which, in this case, increments the line_count counter.
To run this program, we are only required to start mtail with command line flags to point it to our program and to the log we want to monitor. Here are some of the most useful flags for our test case:
|
-address |
Host or IP to bind |
|
-port |
Listener port, defaults to 3903 |
|
-progs |
Path to the ... |
Read now
Unlock full access