Log4j Configuration

I need to edit the log4j configuration in log4j.properties, the file is editible if I exec into it but the changes dont persist accross pod restarts. Is there a way to configure this through the operator or a yaml file?

The log4j2.properties configuration file is part of the container and is ephemeral as any file that is not mounted in a volume.

If you want to change the logging levels I would suggest to first try to use the command-line options or use the cluster settings as described in the Elasticsearch documentation.

If you really know what you are doing you can override the log4j2 configuration using a configMap with something like:

$ kubectl create configmap log4j --from-file=log4j2.properties=/path/to/my/log4j2.properties

Then mount the configmap:

    podTemplate:
      spec:
        containers:
        - name: elasticsearch
          volumeMounts:
          - mountPath: /usr/share/elasticsearch/config/log4j2.properties
            subPath: log4j2.properties
            name: log4j
        volumes:
        - name: log4j
          configMap:
            name: log4j

Thank you, this was very helpful, really appreciate it!