Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matsumotory/mod_resource_checker
Process Resource Logging Module using JSON format into file or piped program
https://github.com/matsumotory/mod_resource_checker
Last synced: about 2 months ago
JSON representation
Process Resource Logging Module using JSON format into file or piped program
- Host: GitHub
- URL: https://github.com/matsumotory/mod_resource_checker
- Owner: matsumotory
- Created: 2012-05-17T05:12:02.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-18T06:12:10.000Z (almost 8 years ago)
- Last Synced: 2024-10-18T18:28:22.010Z (3 months ago)
- Language: C
- Homepage:
- Size: 86.9 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mod_resource_checker [![Build Status](https://travis-ci.org/matsumotory/mod_resource_checker.svg?branch=master)](https://travis-ci.org/matsumotory/mod_resource_checker)
Process Resource Logging Module using JSON format into file or piped program.
Supported apache2.2.x and apache2.4.x with prefork mpm.
[rcheck-analyze](https://github.com/matsumoto-r/rcheck-analyzer) is analyze tool for mod_resource_checker log.
- setup `conf.d/mod_resource_checker.conf`
```apache
LoadModule resource_checker_module modules/mod_resource_checker.soRCheckLogPath /var/log/httpd/resoruce.log
RCheckRealServerName www.matsumoto-r.jpRCheckALL On
```
- check log file
```
tail -n 1 /var/log/httpd/resoruce.log | jq .
```- output logs
```json
{
"result": {
"RCheckMEM": 31.289062,
"RCheckSCPU": 0.06999,
"RCheckUCPU": 0.360945
},
"bytes_sent": 59278,
"size": 418,
"response_time": 0,
"threshold": null,
"pid": 13990,
"scheme": "http",
"filename": "/usr/local/apache/htdocs/blog/index.php",
"remote_ip": "127.0.0.1",
"location": "/",
"unit": null,
"type": "RCheckALL",
"date": "Fri Oct 23 21:24:23 2015",
"module": "mod_resource_checker",
"method": "GET",
"hostname": "blog.matsumoto-r.jp",
"server_ip": "127.0.0.1",
"uri": "/?m=200901",
"handler": "application/x-httpd-php",
"real_server_name": "www.matsumoto-r.jp",
"uid": 500,
"status": 200
}
```##How To Compile
- Build
```
(optional) yum install json-c json-c-devel
make
sudo make install
```- Add to httpd.conf
```apache
LoadModule resource_checker_module modules/mod_resource_checker.so
```##How To Use
### Server Config
- log file name (default /tmp/mod_resource_checker.log if no setting)```
RCheckLogPath "/usr/local/apache/logs/resoruce.log"
```or
- if enable JSON Format `RCheckJSONFormat On`, for exmaple,
```
RCheckLogPath "| mongoimport -d apache -c resource_check"
```It's very cool.
- logging real server name
```
RCheckRealServerName www.matsumoto-r.jp
```### Directive Config
- Logging all status and resources log```apache
RCheckALL On
```
```json
{
"result": {
"RCheckMEM": 39.023438,
"RCheckSCPU": 0.055992,
"RCheckUCPU": 0.481926
},
"response_time": 0,
"threshold": null,
"pid": 22533,
"status": 200,
"scheme": "http",
"filename": "/usr/local/apache244/htdocs/blog/index.php",
"remote_ip": "127.0.0.1",
"location": "/",
"unit": null,
"type": "RCheckALL",
"date": "Sun Oct 11 18:08:12 2015",
"module": "mod_resource_checker",
"method": "GET",
"hostname": "blog.matsumoto-r.jp",
"server_ip": "127.0.0.1",
"uri": "/index.php",
"real_server_name": "www.matsumoto-r.jp",
"uid": 2,
"size": 418,
"content_length": 2498
}
```- Logging all request which don't include resouces data
```apache
RCheckSTATUS On
```
```json
{
"result": 0,
"response_time": 0,
"threshold": null,
"pid": 22533,
"status": 200,
"scheme": "http",
"filename": "/usr/local/apache244/htdocs/blog/index.php",
"remote_ip": "127.0.0.1",
"location": "/",
"unit": null,
"type": "RCheckSTATUS",
"date": "Sun Oct 11 18:08:12 2015",
"module": "mod_resource_checker",
"method": "GET",
"hostname": "blog.matsumoto-r.jp",
"server_ip": "127.0.0.1",
"uri": "/index.php",
"real_server_name": "www.matsumoto-r.jp",
"uid": 2,
"size": 418,
"content_length": 2498
}
```- Logging CPUUserTime
```apache
RCheckUCPU
```- Logging CPUSystemTime
```apache
RCheckSCPU
```- Logging UsedMemory
```apache
RCheckMEMdigit(non-zero)
ALL
SELF
CHILD
```- Directory Access Control
```apacheRCheckUCPU 0.0001 ALL
```
- File Access Control
```apacheRCheckUCPU 0.003 SELF
RCheckSCPU 0.004 CHILD
RCheckJSONFormat On```
- Files Regex Access Control
```apacheRCheckUCPU 0.005 ALL
RCheckMEM 1 ALL```
# License
under the MIT License:* http://www.opensource.org/licenses/mit-license.php