Skip to content

Commit 66d0f32

Browse files
committed
docker/syslog: fluend plugins
1 parent 1749f47 commit 66d0f32

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

fluentd/Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
FROM fluent/fluentd:v1.15-debian-1
22

33
USER root
4-
RUN fluent-gem install fluent-plugin-prometheus -v 2.0.3
5-
6-
USER fluent
7-
8-
EXPOSE 24231
4+
RUN fluent-gem install fluent-plugin-prometheus -v 2.0.3 && \
5+
fluent-gem install fluent-plugin-s3 -v 1.7.1
6+
COPY ./plugins/ /fluentd/plugins/
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module Fluent::Plugin
2+
class HttpHealthCheckInput < Input
3+
Fluent::Plugin.register_input('http_healthcheck', self)
4+
helpers :http_server
5+
6+
desc 'The address to bind to.'
7+
config_param :bind, :string, default: '0.0.0.0'
8+
desc 'The port to listen to.'
9+
config_param :port, :integer, default: 8080
10+
11+
CONTENT_TYPE_TEXT_PLAIN = { 'Content-Type' => 'text/plain' }.freeze
12+
13+
def start
14+
super
15+
16+
log.info "healthcheck endpoint at http://#{@bind}:#{@port}/healthz"
17+
18+
http_server_create_http_server(
19+
:in_http_healthcheck_helper,
20+
addr: @bind,
21+
port: @port,
22+
logger: log,
23+
) do |serv|
24+
serv.get('/healthz') do
25+
if healthy?
26+
[200, CONTENT_TYPE_TEXT_PLAIN, ['ok']]
27+
else
28+
[500, CONTENT_TYPE_TEXT_PLAIN, ['not ok']]
29+
end
30+
end
31+
end
32+
end
33+
34+
private
35+
36+
def healthy?
37+
# TODO: check workers in multi-worker mode
38+
true
39+
end
40+
end
41+
end

0 commit comments

Comments
 (0)