126 |
<h3><a name="31">Monitor a file using regex</a></h3> |
<h3><a name="31">Monitor a file using regex</a></h3> |
127 |
|
|
128 |
This function will allow monit to monitor files such as log files for certain |
This function will allow monit to monitor files such as log files for certain |
129 |
content. Users can specify a regular expression which will be checked |
content. Users can specify a regular expression or files containing regular |
130 |
against the file for each monitor cycle. If a match occurs, monit will |
expressions which will be checked against the file for each monitor cycle. |
131 |
issue one of the standard actions, such as an alert or a exec. Here is an |
If a match occurs, monit will issue one of the standard actions, such as |
132 |
example on how an entry may look like in the monit control file: |
an alert or a exec as long as it not explicitly ignored. Here is an example |
133 |
|
on how an entry may look like in the monit control file: |
134 |
|
|
135 |
<pre> |
<pre> |
136 |
check file syslog with path /var/log/messages |
check file syslog with path /var/log/messages |
137 |
if match "^[A-Za-z]+ .[0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9].* .* .*$" |
if match "^[A-Za-z]+ .[0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9].* .* .*$" |
138 |
then alert |
then alert |
139 |
|
ignore match "^[A-Za-z]+ .[0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9].* monit.* .*$" |
140 |
|
if match /etc/monit/monit.match.use then alert |
141 |
|
ignore match /etc/monit/monit.match.ignore then alert |
142 |
</pre> |
</pre> |
143 |
|
|
144 |
<p>Monit will maintain the offset of each file (a la logtail) so it would |
<p>Monit will maintain the offset of each file (a la logtail) so it would |
154 |
<tr> |
<tr> |
155 |
<td>Progress:</td> |
<td>Progress:</td> |
156 |
<td bgcolor="green" align=center> |
<td bgcolor="green" align=center> |
157 |
<b><font color="#ffffff">99.5%</font></b> |
<b><font color="#ffffff">99.8%</font></b> |
158 |
</td> |
</td> |
159 |
</tr> |
</tr> |
160 |
<tr> |
<tr> |