-
Notifications
You must be signed in to change notification settings - Fork 3
/
r7insight.php
93 lines (61 loc) · 2.8 KB
/
r7insight.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
require_once('R7Logger.php');
/**********
* BEGIN - User - Defined Variables
***********/
// Put your Rapid7 Log Token inside the double quotes in the $LOG_TOKEN constant below.
$LOG_TOKEN = "";
// Put your Rapid7 data center region below
$REGION = "";
/*
* To Send Log Events To Your DataHub, Change The Following Variables
* 1. Change the $DATAHUB_ENABLED variable to true;
* 2. IP Address of your datahub location
* 3. Set the Port for communicating with Datahub (10000 default)
*
* NOTE: If $DATAHUB_ENABLED = true, Datahub will ignore your Insight Platform log token as it is not required when using Datahub.
*/
$DATAHUB_ENABLED = false;
// Your DataHub IP Address MUST be specified if $DATAHUB_ENABLED = true
$DATAHUB_IP_ADDRESS = "";
// Default port for DataHub is 10000,
// If you change this from port 10000, you will have to change your settings port on your datahub machine,
// specifically in the datahub local config file in /etc/leproxy/leproxyLocal.config then restart leproxy - sudo service leproxy restart
$DATAHUB_PORT = 10000;
// Allow Your Host Name To Be Printed To Your Log Events As Key / Value Pairs.
// To give your Log events a Host_Name which will appear in your logs as Key Value Pairs, change this value to 'true' (without quotes)
$HOST_NAME_ENABLED = true;
// Enter a Customized Host Name to appear in your Logs - If no host name is entered one will be assigned based on your own Host name for the local machine using the php function gethostname();
$HOST_NAME = "";
// Enter a Host ID to appear in your Log events
// if $HOST_ID is empty "", it wil not print to your log events. This value will only print to your log events if there is a value below as in $HOST_ID="12345".
$HOST_ID = "123123-123123";
// Add the local server timestamp to each log item
$ADD_LOCAL_TIMESTAMP = true;
// Send the log line in JSON format
$USE_JSON = true;
/************
* END - User - Defined Variables
************/
// Whether the socket is persistent or not
$Persistent = true;
// Whether the socket uses SSL/TLS or not
$SSL = false;
// Set the minimum severity of events to send
$Severity = LOG_DEBUG;
/*
* END User - Defined Variables
*/
// Ignore this, used for PaaS that support configuration variables
$ENV_TOKEN = getenv('LOG_TOKEN');
$ENV_REGION = getenv('REGION');
// Check for environment variable first and override LOG_TOKEN variable accordingly
if ($ENV_TOKEN != false && $LOG_TOKEN === "")
{
$LOG_TOKEN = $ENV_TOKEN;
}
if ($ENV_REGION != false && $REGION === "")
{
$REGION = $ENV_REGION;
}
$log = R7Logger::getLogger($LOG_TOKEN, $REGION, $Persistent, $SSL, $Severity, $DATAHUB_ENABLED, $DATAHUB_IP_ADDRESS, $DATAHUB_PORT, $HOST_ID, $HOST_NAME, $HOST_NAME_ENABLED, $ADD_LOCAL_TIMESTAMP, $USE_JSON);