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

Support overriding the Log4j configuration file location #2720

Closed
dlvenable opened this issue May 19, 2023 · 1 comment · Fixed by #2721
Closed

Support overriding the Log4j configuration file location #2720

dlvenable opened this issue May 19, 2023 · 1 comment · Fixed by #2721
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dlvenable
Copy link
Member

dlvenable commented May 19, 2023

Is your feature request related to a problem? Please describe.

A Data Prepper administrator can change the log4j file. But it is not possible to override the value.

Describe the solution you'd like

Allow setting the configuration file via JAVA_OPTS. See the following:

env JAVA_OPTS="-Dlog4j.configurationFile=custom/path/to/log4j2-rolling.properties" ./bin/data-prepper

Data Prepper already has the JAVA_OPTS environment variable. However, it does not support changing this value. This is because Data Prepper overrides that value.

Describe alternatives you've considered (Optional)

There could be a data-prepper-config.yaml configuration. However, this would come much later and isn't how the current Log4j configuration works.

@dlvenable dlvenable added the enhancement New feature or request label May 19, 2023
@dlvenable dlvenable added this to the v2.4 milestone May 19, 2023
@dlvenable
Copy link
Member Author

As seen below, the DATA_PREPPER_JAVA_OPTS environment variable sets the Log4j configuration file. However, it is set after JAVA_OPTS and thus overrides what the Data Prepper admin sets.

DATA_PREPPER_JAVA_OPTS="-Dlog4j.configurationFile=$DATA_PREPPER_HOME/config/log4j2-rolling.properties"
if [[ $# == 0 ]]; then
exec java $JAVA_OPTS $DATA_PREPPER_HOME_OPTS $DATA_PREPPER_JAVA_OPTS -cp "$DATA_PREPPER_CLASSPATH" org.opensearch.dataprepper.DataPrepperExecute

dlvenable added a commit to dlvenable/data-prepper that referenced this issue May 19, 2023
…ins to override the Log4j configuration file setting. Resolves opensearch-project#2720.

Signed-off-by: David Venable <dlv@amazon.com>
dlvenable added a commit to dlvenable/data-prepper that referenced this issue May 25, 2023
…ins to override the Log4j configuration file setting. Resolves opensearch-project#2720.

Signed-off-by: David Venable <dlv@amazon.com>
dlvenable added a commit that referenced this issue May 25, 2023
…ins to override the Log4j configuration file setting. Resolves #2720. (#2721)

Signed-off-by: David Venable <dlv@amazon.com>
@dlvenable dlvenable modified the milestones: v2.4, v2.3 May 31, 2023
@dlvenable dlvenable self-assigned this May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant