|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Short description for file |
4 | | - * |
5 | | - * Long description for file (if any)... |
| 3 | + * The Syslog class is a syslog client implementation in PHP |
| 4 | + * following the RFC 3164, 5424, 5425, 5426 rules. |
| 5 | + * This class is compatible with PHP logger constants for serverity and facility. |
| 6 | + * Default value are UDP connection with RFC3164 mode |
6 | 7 | * |
7 | 8 | * PHP version 5 |
8 | 9 | * |
9 | | - * LICENSE: * Copyright 2013 Laurent Vromman |
| 10 | + * LICENSE: |
10 | 11 | * |
11 | 12 | * This program is free software: you can redistribute it and/or modify |
12 | 13 | * it under the terms of the GNU LesserGeneral Public License as published by |
|
30 | 31 | * @link http://pear.php.net/package/Net_Syslog |
31 | 32 | */ |
32 | 33 |
|
33 | | -/* |
34 | | -* Place includes, constant defines and $_GLOBAL settings here. |
35 | | -* Make sure they have appropriate docblocks to avoid phpDocumentor |
36 | | -* construing they are documented by the page-level docblock. |
37 | | -*/ |
38 | 34 |
|
| 35 | +// {{{ constants |
| 36 | + |
| 37 | +/** |
| 38 | + * Set default linux network interface |
| 39 | + */ |
| 40 | +define("NET_SYSLOG_LINUX_NETWORD_INTERFACE", "eth0"); |
| 41 | + |
| 42 | +/** |
| 43 | + * Set NILVALUE as defined in RFC 5424 |
| 44 | + */ |
| 45 | +define("NET_SYSLOG_NILVALUE", "-"); |
| 46 | + |
| 47 | +/** |
| 48 | + * Add missing LOG_FTP level log to existing PHP log levels |
| 49 | + */ |
| 50 | +defined('LOG_FTP') or define("LOG_FTP", 88); |
| 51 | + |
| 52 | + |
| 53 | +/** |
| 54 | + * Add missing LOG_NTP level log to existing PHP log levels |
| 55 | + */ |
| 56 | +defined('LOG_NTP') or define("LOG_NTP", 96); |
| 57 | + |
| 58 | + |
| 59 | +/** |
| 60 | + * Add missing LOG_LOG_AUDIT level log to existing PHP log levels |
| 61 | + */ |
| 62 | +defined('LOG_LOG_AUDIT') or define("LOG_LOG_AUDIT", 104); |
| 63 | + |
| 64 | + |
| 65 | +/** |
| 66 | + * Add missing LOG_ALERT level log to existing PHP log levels |
| 67 | + */ |
| 68 | +defined('LOG_ALERT') or define("LOG_ALERT", 112); |
| 69 | + |
| 70 | + |
| 71 | +/** |
| 72 | + * Add missing LOG_CLOCK level log to existing PHP log levels |
| 73 | + */ |
| 74 | +defined('LOG_CLOCK') or define("LOG_CLOCK", 120); |
| 75 | + |
| 76 | +/** |
| 77 | + * TCP connection mode |
| 78 | + */ |
| 79 | +define("NET_SYSLOG_TCP", "tcp"); |
| 80 | + |
| 81 | +/** |
| 82 | + * UDP connection mode |
| 83 | + */ |
| 84 | +define("NET_SYSLOG_UDP", "udp"); |
| 85 | + |
| 86 | +/** |
| 87 | + * SSL connection mode |
| 88 | + */ |
| 89 | +define("NET_SYSLOG_SSL", "ssl"); |
| 90 | + |
| 91 | +/** |
| 92 | + * TLS connection mode |
| 93 | + */ |
| 94 | +define("NET_SYSLOG_TLS", "tls"); |
| 95 | + |
| 96 | +/** |
| 97 | + * Compatibility for RFC 5424, 5425 and 5426 |
| 98 | + */ |
| 99 | +define("NET_SYSLOG_RFC542X", 1); |
| 100 | + |
| 101 | +/** |
| 102 | + * Compatibility for RFC 3164 |
| 103 | + */ |
| 104 | +define("NET_SYSLOG_RFC3164", 0); |
| 105 | +// }}} |
39 | 106 |
|
40 | 107 | /** |
41 | | - * |
42 | | - * Description |
43 | | - * |
44 | | - * The Syslog class is a syslog client implementation in PHP |
45 | | - * following the RFC 3164, 5424, 5425, 5426 rules. |
46 | | - * This class is compatible with PHP logger constants for serverity and facility. |
47 | | - * |
48 | | - * Default value are UDP connection with RFC3164 mode. |
49 | 108 | * |
50 | 109 | * Facility values: |
51 | 110 | * LOG_KERN kernel messages |
52 | 111 | * LOG_USER user-level messages |
53 | 112 | * LOG_MAIL mail system |
54 | | - * LOG_DAEMON system daemons |
| 113 | + * LOG_DAEMON system daemons |
55 | 114 | * LOG_AUTH security/authorization messages |
56 | 115 | * LOG_SYSLOG messages generated internally by syslogd |
57 | | - * LOG_LPR line printer subsystem |
| 116 | + * LOG_LPR line printer subsystem |
58 | 117 | * LOG_NEWS network news subsystem |
59 | 118 | * LOG_UUCP UUCP subsystem |
60 | 119 | * LOG_CRON clock daemon |
61 | 120 | * LOG_AUTHPRIV security/authorization messages |
62 | 121 | * LOG_FTP FTP daemon |
63 | | - * LOG_NTP NTP subsystem |
| 122 | + * LOG_NTP NTP subsystem |
64 | 123 | * LOG_AUDIT log audit |
65 | 124 | * LOG_LOG_ALERT log alert |
66 | 125 | * LOG_CLOCK clock daemon |
|
77 | 136 | * LOG_EMERG Emergency: system is unusable |
78 | 137 | * LOG_ALERT Alert: action must be taken immediately |
79 | 138 | * LOG_CRIT Critical: critical conditions |
80 | | - * LOG_ERR Error: error conditions |
81 | | - * LOG_WARNING Warning: warning conditions |
| 139 | + * LOG_ERR Error: error conditions |
| 140 | + * LOG_WARNING Warning: warning conditions |
82 | 141 | * LOG_NOTICE Notice: normal but significant condition (default value) |
83 | 142 | * LOG_INFO Informational: informational messages |
84 | 143 | * LOG_DEBUG Debug: debug-level messages |
85 | 144 | * |
86 | 145 | * Protocols: |
87 | | - * SYSLOG_UDP udp protocol. Defaut behaviour |
88 | | - * SYSLOG_TCP tcp protocol |
89 | | - * SYSLOG_SSL ssl protocol. CA File can optionnaly be set |
90 | | - * SYSLOG_TLS tls protocol |
| 146 | + * NET_SYSLOG_UDP udp protocol. Defaut behaviour |
| 147 | + * NET_SYSLOG_TCP tcp protocol |
| 148 | + * NET_SYSLOG_SSL ssl protocol. CA File can optionnaly be set |
| 149 | + * NET_SYSLOG_TLS tls protocol |
91 | 150 | * |
92 | 151 | * |
93 | 152 | * Usage |
|
141 | 200 | * * In Windows, PHP Sockets can be activated by un-commenting |
142 | 201 | * extension=php_sockets.dll in php.ini |
143 | 202 | * |
144 | | - * Licence |
145 | | - * |
146 | | - * Copyright 2013 Laurent Vromman |
147 | | - * |
148 | | - * This program is free software: you can redistribute it and/or modify |
149 | | - * it under the terms of the GNU LesserGeneral Public License as published by |
150 | | - * the Free Software Foundation, either version 3 of the License, or |
151 | | - * (at your option) any later version. |
152 | | - * |
153 | | - * This program is distributed in the hope that it will be useful, |
154 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
155 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
156 | | - * GNU Lesser General Public License for more details. |
157 | | - * |
158 | | - * You should have received a copy of the GNU General Public License |
159 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
160 | 203 | * |
161 | 204 | * TODO : RFC 5848, RFC 6587, Permanent socket |
162 | 205 | * |
163 | 206 | */ |
164 | 207 |
|
165 | | -define("NET_SYSLOG_LINUX_NETWORD_INTERFACE", "eth0"); |
166 | | -define("NET_SYSLOG_NILVALUE", "-"); |
167 | | - |
168 | | -define("LOG_FTP", 88); |
169 | | -define("LOG_NTP", 96); |
170 | | -define("LOG_LOG_AUDIT", 104); |
171 | | -define("LOG_ALERT", 112); |
172 | | -define("LOG_CLOCK", 120); |
173 | | - |
174 | | -define("NET_SYSLOG_TCP", "tcp"); |
175 | | -define("NET_SYSLOG_UDP", "udp"); |
176 | | -define("NET_SYSLOG_SSL", "ssl"); |
177 | | -define("NET_SYSLOG_TLS", "tls"); |
178 | | -// Compatibility for RFC 5424, 5425 and 5426 |
179 | | -define("NET_SYSLOG_RFC542X", 1); |
180 | | -define("NET_SYSLOG_RFC3164", 0); |
181 | | - |
182 | 208 | /** |
183 | 209 | * Short description for class |
184 | 210 | * |
|
0 commit comments