atlassian / data-center-helm-charts

Helm charts for Atlassian's Data Center products
https://atlassian.github.io/data-center-helm-charts/
Apache License 2.0
150 stars 129 forks source link

Set atlassian.logging.cloud.enabled system property to false if a custom FluentD config is used #796

Closed bianchi2 closed 2 months ago

bianchi2 commented 2 months ago

Current behavior

If fluentd.enabled=true we automatically set -Datlassian.logging.cloud.enabled=true in jvm configmap. This, however, has an undesirable effect if FluentD in a sidecar runs in a non-server mode, for example, type @tail:

<source>
  @type tail
  tag app_logs.atlassian-confluence
  path /opt/atlassian/confluence/logs/atlassian-confluence.log
  pos_file /opt/atlassian-confluence.pos
  <parse>
    @type none
  </parse>
</source>

As a result, Confluence and Jira will try to push logs to localhost:9880 which is the default FluentD port, and logs will be cluttered with networking errors because Confluence/Jira will try to push logs to 9880 port on localhost but nothing listens on that port. This happens because of the following config in log4j.properties:

# This appender will post logs events in JSON format to a fluentd service.
# It is inactive by default, and activation requires setting the "atlassian.logging.cloud.enabled" system property to "true"
log4j.appender.fluentdAppender=com.atlassian.logging.log4j.appender.FluentdAppender
# This is currently hard-wired, since FluentdAppender currently doesn't allow it to be configured via system property.
log4j.appender.fluentdAppender.FluentdEndpoint=http://localhost:9880/

New Behavior

This PR suggests that -Datlassian.logging.cloud.enabled is set to true only if the default fluentd config is used. Users with custom FluentD config running it in a server mode, type @http, e.g.:

<source>
  @type http
  port {{ .Values.fluentd.httpPort }}
  bind 0.0.0.0
</source>

will have to add -Datlassian.logging.cloud.enabled=true to ${product}.additionalJvmArgs in Helm values file.

Checklist