This repository was archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
56 lines (41 loc) · 1.48 KB
/
README
File metadata and controls
56 lines (41 loc) · 1.48 KB
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
A simple logfile parser for kannel SMPP logfiles that sends statistics to Graphite
Running the parser:
$ php parse.php --xml sample.xml
A simple cron script example parser:
$basePath = dirname(__DIR__);
require_once $basePath . '/lib/Parser.php';
$script = array_shift($argv);
$switch = array_shift($argv);
$xmlConfig = array_shift($argv);
try {
$parser = LogParser::getInstance($xmlConfig);
$parser->run();
} catch(Exception $e) {
echo $e->getMessage();
}
Where ../config/sample.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- With debugging enabled no data will be send to Graphite but instead pushed to stdout -->
<debug>false</debug>
<!-- Push output to stdout -->
<verbose>true</verbose>
<!-- Location where we should store the state file -->
<state_file>/state/file/location.state</state_file>
<!-- Location of the logfile -->
<log_file>/log/file/location.log</log_file>
<!-- Location of the logtail2 binary -->
<logtail_bin>/usr/sbin/logtail2</logtail_bin>
<!-- Regular expression to parse logfile lines -->
<regexp>/^(\S+) (\S+) (\S+) FAILED .*/</regexp>
<!-- The regex field number to use for graphite stats -->
<regex_num>3</regex_num>
<!-- Graphite settings -->
<graphite>
<enabled>true</enabled>
<label>graphite.stats.string</label>
<host>localhost</host>
<port>2003</port>
<timeout>30</timeout>
</graphite>
</config>