-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fluentd haproxy parser through log files
- Loading branch information
Showing
8 changed files
with
1,089 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "https://rubygems.org" | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# fluentd-logfile-haproxy-parser | ||
A fluentd haproxy parser for logs from a log file | ||
# fluentd-syslog-haproxy-plugin | ||
An logfile haproxy http log parser | ||
|
||
## Usage | ||
|
||
This plugins works with default http log format from HAProxy: | ||
|
||
``` | ||
log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r" | ||
``` | ||
|
||
## Installing steps | ||
|
||
``` | ||
gem build fluentd-logfile-haproxy-parser.gemspec | ||
fluent-gem install fluentd-logfile-haproxy-parser-0.0.1.gem | ||
``` | ||
|
||
## Full fluentd configuration | ||
|
||
``` | ||
<source> | ||
@type tail | ||
path <path>/haproxy.log | ||
pos_file <path>/pos/haproxy.pos | ||
read_from_head true | ||
<parse> | ||
@type haproxy_logfile | ||
</parse> | ||
tag haproxy | ||
</source> | ||
<match **> | ||
@type stdout | ||
</match> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<source> | ||
@type tail | ||
path <path>/haproxy.log | ||
pos_file <path>/pos/haproxy.pos | ||
read_from_head true | ||
<parse> | ||
@type haproxy_logfile | ||
</parse> | ||
tag haproxy | ||
</source> | ||
|
||
<match **> | ||
@type stdout | ||
</match> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
lib = File.expand_path("../lib", __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "fluentd-logfile-haproxy-parser" | ||
spec.version = "0.0.1" | ||
spec.authors = ["slk"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = "An haproxy log file parser" | ||
spec.description = "An haproxy log file parser" | ||
spec.homepage = "https://github.com/slk244/fluentd-logfile-haproxy-parser" | ||
spec.license = "AGPL-3.0" | ||
|
||
spec.files = ["./lib/fluent/plugin/parser_haproxy_logfile.rb"] | ||
spec.executables = [] | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,301 @@ | ||
{ | ||
"template" : "haproxy*", | ||
"version" : 50001, | ||
"settings" : { | ||
"index.refresh_interval" : "5s" | ||
}, | ||
"mappings" : { | ||
"_default_" : { | ||
"properties" : { | ||
"@timestamp" : { | ||
"type" : "date" | ||
}, | ||
"actconn" : { | ||
"type" : "short" | ||
}, | ||
"auth_type" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"b_end" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"b_server" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"backend_queue" : { | ||
"type" : "short" | ||
}, | ||
"beconn" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"bytes" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"c_ip" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"c_port" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"f_end" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"feconn" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"hatime" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"http_version" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"message" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"method" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"path" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"pid" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"ps" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"query_string" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"referer" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"req_cookie" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"res_cookie" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"res_headers" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"retries" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"srv_conn" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"srv_queue" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"status_code" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"t_state" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"tc" : { | ||
"type" : "integer" | ||
}, | ||
"time" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"tq" : { | ||
"type" : "integer" | ||
}, | ||
"tr" : { | ||
"type" : "integer" | ||
}, | ||
"tt" : { | ||
"type" : "integer" | ||
}, | ||
"tw" : { | ||
"type" : "integer" | ||
}, | ||
"user" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"user_agent" : { | ||
"type" : "text", | ||
"fields" : { | ||
"keyword" : { | ||
"type" : "keyword", | ||
"ignore_above" : 256 | ||
} | ||
} | ||
}, | ||
"worker" : { | ||
"type" : "long" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.