Commit 8ab2e9c6 authored by Satnam Singh's avatar Satnam Singh

Use DNS for Elasticsearch

parent af2ded7b
...@@ -6,9 +6,6 @@ containers: ...@@ -6,9 +6,6 @@ containers:
volumeMounts: volumeMounts:
- name: containers - name: containers
mountPath: /var/lib/docker/containers mountPath: /var/lib/docker/containers
- name: hosts
mountPath: /outerhost
readOnly: true
- name: varlog - name: varlog
mountPath: /varlog mountPath: /varlog
volumes: volumes:
...@@ -20,7 +17,3 @@ volumes: ...@@ -20,7 +17,3 @@ volumes:
source: source:
hostDir: hostDir:
path: /var/log path: /var/log
- name: hosts
source:
hostDir:
path: /etc/hosts
...@@ -33,10 +33,5 @@ RUN /usr/sbin/td-agent-gem install fluent-plugin-elasticsearch ...@@ -33,10 +33,5 @@ RUN /usr/sbin/td-agent-gem install fluent-plugin-elasticsearch
# Copy the Fluentd configuration file. # Copy the Fluentd configuration file.
COPY td-agent.conf /etc/td-agent/td-agent.conf COPY td-agent.conf /etc/td-agent/td-agent.conf
# Copy a script that determines the name of the host machine # Run the Fluentd service.
# and then patch the Fluentd configuration files and then CMD /usr/sbin/td-agent -qq > /var/log/td-agent/td-agent.log
# run Fluentd in the foreground.
ADD run.sh /run.sh
# Always run the this setup script.
ENTRYPOINT ["/run.sh"]
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WARNING! HORRIBLE HACK! We expect /outerhost to be mapped to
# the enclosing /etc/host file so we can determine the name of
# the host machine (super fragile). This is a temporary hack until
# service IPs are done.
OUTER_HOST=`tail -n 1 /outerhost | awk '{print $3}'`
# WARNING! HORRIBLE HACK! We expect /outerhost to be mapped to
# the enclosing /etc/host file so we can determine the name of
# the host machine (super fragile). This is a temporary hack until
# service IPs are done.
# Adjust the name of the host machine for %ES_HOST%. HACK!
sed -i -e "s/\%ES_HOST\%/${OUTER_HOST}/" /etc/td-agent/td-agent.conf
/usr/sbin/td-agent -qq "$@"
...@@ -47,10 +47,14 @@ ...@@ -47,10 +47,14 @@
type elasticsearch type elasticsearch
log_level info log_level info
include_tag_key true include_tag_key true
host %ES_HOST% host elasticsearch.default
port 9200 port 9200
logstash_format true logstash_format true
flush_interval 5s flush_interval 5s
# Never wait longer than 5 minutes between retries.
max_retry_wait 300
# Disable the limit on the number of retries (retry forever).
disable_retry_limit
</match> </match>
<source> <source>
...@@ -65,8 +69,12 @@ ...@@ -65,8 +69,12 @@
type elasticsearch type elasticsearch
log_level info log_level info
include_tag_key true include_tag_key true
host %ES_HOST% host elasticsearch.default
port 9200 port 9200
logstash_format true logstash_format true
flush_interval 5s flush_interval 5s
# Never wait longer than 5 minutes between retries.
max_retry_wait 300
# Disable the limit on the number of retries (retry forever).
disable_retry_limit
</match> </match>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment