https://github.com/tecnickcom/logpipe
PHP module to extend the default PHP error handling function.
https://github.com/tecnickcom/logpipe
Last synced: 8 months ago
JSON representation
PHP module to extend the default PHP error handling function.
- Host: GitHub
- URL: https://github.com/tecnickcom/logpipe
- Owner: tecnickcom
- License: other
- Created: 2015-02-23T12:07:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-02-01T10:50:40.000Z (over 5 years ago)
- Last Synced: 2025-01-07T09:46:10.965Z (9 months ago)
- Language: C
- Size: 17.6 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.TXT
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
LogPipe for PHP - README
========================+ Name: LogPipe for PHP
+ Version: 1.2.0
+ Release date: 2012-08-30
+ Author: Nicola Asuni
DESCRIPTION:
------------LogPipe is a PHP module to extend the default PHP error handling function.
This module allows to send logs to SysLog or pipe the logs to an external program.It extends a standard log line to contain:
+ the IP address of the server under which the current script is executing ($_SERVER['SERVER_ADDR'] variable);
+ the host name of the server under which the current script is executing ($_SERVER['HTTP_HOST'] variable);
+ the client IP address ($_SERVER['REMOTE_ADDR'] variable).The IP address and host name on the log line can be used by an external program to split or aggregate PHP logs based on the Virtual host.
This module has been designed mainly as a complement for the TCPWebLog project (http://catn.com/cloud-computing/tcpweblog-collecting-and-aggregating-web-logs-on-the-cloud/).
COMPILE AND INSTALL:
====================Before you start, make sure you have php-devel package installed in your system.
1. get the source code:
cd ~
git clone git://github.com/fubralimited/LogPipe.git2. compile the module:
cd ~/LogPipe
phpize
./configure --enable-logpipe
make3. copy the module on the PHP module directory:
cp ./modules/logpipe.so /usr/lib64/php/modules/
4. copy and edit the configuration INI file:
cp logpipe.ini /etc/php.d/
vi /etc/php.d/logpipe.iniConfiguration examples:
disable the module:
; MODULE DISABLED
extension=/usr/lib64/php/modules/logpipe.so
logpipe.mode=0
logpipe.command=""send logs to syslog:
; SYSLOG
extension=/usr/lib64/php/modules/logpipe.so
logpipe.mode=1
logpipe.command="local4"send logs to TCPWebLog:
; TCPWEBLOG (check the LogPipe documentation for the correct parameters)
extension=/usr/lib64/php/modules/logpipe.so
logpipe.mode=2
logpipe.command="/usr/bin/tcpweblog_client.bin 10.0.2.15 9940 /var/log/tcpweblog_cache.log php.log 1 - -"5. Restart syslog-ng (only if you are using the syslog mode):
service syslog-ng restart
6. Restart Apache:
apachectl restart
HOW-TO CREATE LogPipe RPMs
------------------------------This is a short hands-on tutorial on creating RPM files for the LogPipe project.
For an automatic building script for CentOS and the latest RPM packages please check the CatN Repository: https://github.com/fubralimited/CatN-Repo## DEVELOPMENT ENVIRONMENT ##
To build RPMs we need a set of development tools.
This is a one-time-only setup, installed by running those commands from a system administration (root) account.
NOTE: You may need to change the the
Install the EPEL repository:# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/$(uname -m)/epel-release-6-7.noarch.rpm
Install development tools and Fedora packager:
# yum install @development-tools
# yum install fedora-packagerThe following packages are required to create LogPipe RPMs:
# yum install php-devel elfutils-devel
Create a dummy user specifically for creating RPM packages:
# /usr/sbin/useradd makerpm
# passwd makerpmReboot the machine, log as makerpm user and create the required directory structure in your home directory by executing:
$ rpmdev-setuptree
The rpmdev-setuptree program will create the ~/rpmbuild directory and a set of subdirectories (e.g. SPECS and BUILD), which you will use for creating your packages. The ~/.rpmmacros file is also created, which can be used for setting various options.
## CREATE THE LogPipe RPMs ##
Download the LogPipe sources:
$ cd ~
$ git clone git://github.com/fubralimited/LogPipe.gitCopy the SPEC files and source files to rpmbuild dir:
$ cd ~/LogPipe
$ export SUVER=$(cat VERSION)
$ cp logpipe.spec ~/rpmbuild/SPECS/
$ tar -zcvf ~/rpmbuild/SOURCES/logpipe-$SUVER.tar.gz *Create the RPMs:
$ cd ~/rpmbuild/SPECS/
$ rpmbuild -ba logpipe.specThe RPMs are now located at ~/rpmbuild/RPMS/$(uname -m)
INSTALL LOGPIPE RPM:
---------------------------As root install the LogPipe RPM file:
# rpm -i logpipe-1.2.0-1.el6.$(uname -m).rpm
Configure the LogPipe# nano /etc/php.d/logpipe.ini