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

Make log4j example easier to run against staging #455

Merged
merged 1 commit into from
Oct 4, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions other-examples/java/logs-in-context-log4j2/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEW_RELIC_OTLP_ENDPOINT=https://otlp.nr-data.net:4317
NEW_RELIC_API_KEY=
8 changes: 2 additions & 6 deletions other-examples/java/logs-in-context-log4j2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@ The following image illustrates a similar example using FluentBit:
Next, build and run the application:

```shell
// Build the application
docker compose build
./gradlew logs-in-context-log4j2:bootJar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this actually necessary?


// Export your New Relic API key as an environment variable
export NEW_RELIC_API_KEY=<INSERT-API-KEY-HERE>

// Run the application and the collector with docker compose
docker compose up
// Build and run the application
docker compose up --build
```

Navigate to the app in a browser at `http://localhost:8080`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
# Logs are forwarded to collector using fluentd
OTEL_LOGS_EXPORTER: none
OTEL_EXPORTER_OTLP_ENDPOINT: 'http://collector:4317'
OTEL_EXPERIMENTAL_RESOURCE_DISABLED_KEYS: 'process.command_line,process.command_args'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example is broken without this

ports:
- '8080:8080'
logging:
Expand All @@ -23,6 +24,7 @@ services:
command: ["--config=/otel-config.yaml"]
environment:
LOG_EXPORTER_LOG_VERBOSITY: "detailed"
NEW_RELIC_OTLP_ENDPOINT: ${NEW_RELIC_OTLP_ENDPOINT}
NEW_RELIC_API_KEY: '${NEW_RELIC_API_KEY}'
ports:
- '4317:4317' # OTLP gRPC receiver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exporters:
logging:
verbosity: $LOG_EXPORTER_LOG_VERBOSITY
otlp:
endpoint: https://otlp.nr-data.net:4317
endpoint: $NEW_RELIC_OTLP_ENDPOINT
headers:
"api-key": $NEW_RELIC_API_KEY
service:
Expand Down