log-monitor活动日志监控

联合创作 · 2023-09-30 00:20

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();

 

浏览 2
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报