软件简介

log-monitor 是基于 tail 命令一个活动日志监控器。

为什么要使用日志监控器?

有时我们想知道 crontab 任务运行时正在发生什么,或者通过 php 脚本将什么错误写入了 php 错误日志中,我们想快速知道。日志监视器可以帮助您监视日志并通知想要知道的用户。

日志监控器可以做什么?

  • 通过 tail 命令监视日志
  • 出现错误时通知用户
  • 自定义日志过滤器界面,它将检查日志是否错误
  • 自定义通知界面,它将通知用户
  • 自定义阅读器界面,如果您不想使用 tail 命令

使用示例:

Just remember that when you call the start method, do not forget to call wait method.
$reader = new \Jenner\LogMonitor\Reader\Reader('/var/log/messages');
$filter = new Jenner\LogMonitor\Filter\ExceptionFilter();
$notify = new \Jenner\LogMonitor\Notification\EchoNotification();
$process = new \Jenner\LogMonitor\MonitorTask($reader, $filter, $notify);
$process->run();
$process->wait();

 

转载自: https://www.oschina.net/p/log-monitor