Download the PHP package rapid7/r7insight_php without Composer
On this page you can find all versions of the php package rapid7/r7insight_php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rapid7/r7insight_php
More information about rapid7/r7insight_php
Files in rapid7/r7insight_php
Package r7insight_php
Short Description Logging library for use with the Insight Platform
License MIT
Informations about the package r7insight_php
r7insight_php
With these simple steps you can send your PHP application logs to the Insight Platform.
- r7insight_php
- Insight Platform Setup
- Composer install
- Parameter Setup
- Adding a Custom Host Name and Host ID sent in your PHP log events
- Code Setup
Insight Platform Setup
Once you have made your account on the Insight platform, log in and use the "Quick Add" option in the "Add data" page to add a new log, using the Token TCP option.
The Log Token and data endpoint will be displayed.
The Log Token is a unique identifier for the log allowing for write-only access.
Take note of these.
Composer install
This package is also available on Composer.
You can install this package by doing the following:
Parameter Setup
Inside the r7insight_php
folder, open r7insight.php
and fill in the LOG_TOKEN
parameter.
LOG_TOKEN
is the token you copied earlier from the Insight Platform UI, and associates that logger with the log in Insight Platform.
In the REGION
field, enter the region code - e.g. us
, eu
, ca
, au
etc.
You can also supply both of these by the use of environment variables with the same name -- LOG_TOKEN
and REGION
.
Adding a Custom Host Name and Host ID sent in your PHP log events
To set a custom Host Name that will appear in your PHP log events as Key / Value pairs:
Inside the r7insight_php
folder, open r7insight.php
and fill in the parameters as follows:
$HOST_NAME_ENABLED = true;
$HOST_NAME = "Custom_host_name_here";
$HOST_ID = "Custom_ID_here_12345";
The $HOST_NAME
constant can be left as an empty string, and the library will automatically attempt to assign a host name from
your local host machine and use that as the custom host name.
To set a custom Host ID that will appear in your PHP log events as Key / Value pairs:
Enter a value instead of the empty string in $HOST_ID = "";
If no $HOST_ID
is set and the empty string is left unaltered, no Host ID or Key / Value pairing will appear in your PHP logs.
If you want to send log events in JSON format, then set the $USE_JSON
field to true
. If you set it to false
, then the logs will be sent in KVP (Key Value Pair) format.
Code Setup
Now you need to download/clone the library from GitHub and place the folder in your apps directory.
To use it in your code, enter the following lines, making changes accordingly if you place it in a different location.