PHP监视器,用于我所有的应用程序和站点的错误,日志等 [英] PHP monitor for all my apps' and sites' errors, logs, etc

查看:160
本文介绍了PHP监视器,用于我所有的应用程序和站点的错误,日志等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要什么



我想在PHP中有一个内部的网络应用程序,我可以看看我的所有错误,日志等我的所有应用程序和网站。



让我画一个图片来解释:我想去看看monitor.thecompany.com,我会看到有在client1.com上上传一个文件,并在client2.com上注册了一个新用户的错误。



内部



我想我会在我的应用程序和网站中调用一个函数(例如$ code> send_to_monitor($ type,$ title,$ description)),它会将数据发送到这个监视器服务。这个服务然后将数据保存到数据库,然后在页面中显示所有的错误和日志(例如monitor.thecompany.com)。



h2>


  1. 已经有解决方案了吗?我是一个编码器,所以这对我来说并不重要,但是为了防万一。如果有的话,我只想要在我的应用程序中轻松实现的东西。

  2. 该服务的API是什么?我该怎么办? RESTful(我该如何实现)?我不需要确切的代码,只是指向正确的方向。

  3. 我如何从客户端应用程序调用此服务?

  4. 安全?我不是担心有人会读取我的日志,但如果服务完全开放,可能会引发新的错误。


 功能监视器($ type,$ title,$ description){
$ ch = curl_init();
curl_setopt($ ch,CURLOPT_URL,http://your.error/and_log/handler.php);
curl_setopt($ ch,CURLOPT_POST,1);
curl_setopt($ ch,CURLOPT_POSTFIELDS,type =。$ type。& title =。$ title。& desc =。$ description。& password = 6as5d465as4df987498 * / * / * +§§§);
curl_exec($ ch);
curl_close($ ch);
}

http://your.error/and_log/handler.php 将处理数据并保存



没有什么可以


What I'd like

I'd like to have an internal web app in PHP where I can look at all my errors, logs, etc., from all my apps and sites.

Let me paint a picture to explain: I'd like to go to something like monitor.thecompany.com and I will see that there was an error uploading a file on client1.com and that a new user was registered at client2.com.

Internals

I imagine that I would call a function in my apps and sites (something like send_to_monitor($type, $title, $description)), which would send the data to this monitor service. This service would then save the data to the database and later display all the errors and logs for me in a page (e.g. monitor.thecompany.com).

Questions

  1. Is there a solution for this already? I'm a coder so this is not that important for me, but just in case. And if there is, I only want something that can be easily implemented in my apps.
  2. What would be the API for the service? How would I do that? RESTful (how would I implement that)? I don't need exact code, just pointers in the right direction.
  3. How would I call this service from the client app?
  4. What about security? I'm not that worried that someone will read my logs, but if the service is completely open someone could throw new errors in.

解决方案

What about easy function that would save your logs to one central database?

function monitor($type, $title, $description){
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL,"http://your.error/and_log/handler.php"); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, "type=".$type."&title=".$title."&desc=".$description."&password=6as5d465as4df987498*/*/*+§§§"); 
    curl_exec ($ch); 
    curl_close ($ch); 
}

http://your.error/and_log/handler.php will proccess data and save it

There's nothing easier

这篇关于PHP监视器,用于我所有的应用程序和站点的错误,日志等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆