Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1722380: Logging data from all projects are stored to .orphaned indexes with Elasticsearch #1680

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions fluentd/configs.d/openshift/filter-k8s-meta.conf
Expand Up @@ -5,13 +5,20 @@
watch "#{ENV['K8S_METADATA_WATCH'] || 'false'}"
bearer_token_file /var/run/secrets/kubernetes.io/serviceaccount/token
ca_file /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
use_journal "#{ENV['USE_JOURNAL'] || 'false'}"
use_journal "#{ENV['USE_JOURNAL'] || 'nil'}"
container_name_to_kubernetes_regexp '^(?<name_prefix>[^_]+)_(?<container_name>[^\._]+)(\.(?<container_hash>[^_]+))?_(?<pod_name>[^_]+)_(?<namespace>[^_]+)_[^_]+_[^_]+$'
</filter>

<filter kubernetes.**>
<filter kubernetes.journal.**>
@type parse_json_field
merge_json_log "#{ENV['MERGE_JSON_LOG'] || 'false'}"
preserve_json_log "#{ENV['PRESERVE_JSON_LOG'] || 'true'}"
json_fields "#{ENV['JSON_FIELDS'] || 'MESSAGE,log'}"
</filter>

<filter kubernetes.var.log.containers.**>
@type parse_json_field
merge_json_log "#{ENV['MERGE_JSON_LOG'] || 'false'}"
preserve_json_log "#{ENV['PRESERVE_JSON_LOG'] || 'true'}"
json_fields "#{ENV['JSON_FIELDS'] || (ENV['USE_JOURNAL'] == 'true' ? 'MESSAGE,log' : 'log,MESSAGE')}"
json_fields "#{ENV['JSON_FIELDS'] || 'log,MESSAGE'}"
</filter>
25 changes: 0 additions & 25 deletions fluentd/run.sh
Expand Up @@ -59,24 +59,6 @@ issue_deprecation_warnings() {
: # none at the moment
}

docker_uses_journal() {
# need to be able to handle cases like
# OPTIONS='--log-driver=json-file ....' # or use --log-driver=journald
# if "log-driver" is set in /etc/docker/daemon.json, assume that it is
# authoritative
# otherwise, look for /etc/sysconfig/docker
# also note the unintuitive logic - in this case, a 0 return means true, and a 1
# return means false
if grep -q '^[^#].*"log-driver":' /etc/docker/daemon.json 2> /dev/null ; then
if grep -q '^[^#].*"log-driver":.*journald' /etc/docker/daemon.json 2> /dev/null ; then
return 0
fi
elif grep -q "^OPTIONS='[^']*--log-driver[ =][ ]*journald" /etc/sysconfig/docker 2> /dev/null ; then
return 0
fi
return 1
}

if [ -z "${USE_MUX:-}" -o "${USE_MUX:-}" = "false" ] ; then
if [ -z "${JOURNAL_SOURCE:-}" ] ; then
if [ -d /var/log/journal ] ; then
Expand All @@ -85,13 +67,6 @@ if [ -z "${USE_MUX:-}" -o "${USE_MUX:-}" = "false" ] ; then
export JOURNAL_SOURCE=/run/log/journal
fi
fi
if [[ "$USE_CRIO" == true ]]; then
export USE_JOURNAL=false
elif docker_uses_journal ; then
export USE_JOURNAL=true
else
export USE_JOURNAL=false
fi
unset MUX_FILE_BUFFER_STORAGE_TYPE
else
# mux requires USE_JOURNAL=true so that the k8s meta plugin will look
Expand Down