-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: adjusting container instrumentation infrastructure monitoring to highlight assignment of container logs #16709
Closed
Closed
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8d2c574
Adjusting container instrumentation infrastructure monitoring to high…
harrykimpel 763e136
Merge branch 'newrelic:develop' into develop
harrykimpel a18e2a0
fix: adjusting container instrumentation infrastructure monitoring to…
harrykimpel 5982e6d
fix: adjusting container instrumentation infrastructure monitoring fo…
harrykimpel 38cec0b
Merge remote-tracking branch 'origin' into pr/16709
akristen 97d0c58
copy edit on call out
akristen 87fdd88
Updating screenshots, formatting doc, added some do not translate tags
akristen 1b67669
partial edits, removing redundant images
akristen c8a6db6
updated some titles to make these docs clearer
akristen 27cb028
fixing yaml
akristen 867fddb
Merge branch 'newrelic:develop' into develop
harrykimpel c645643
fix: adjusting container instrumentation infrastructure monitoring to…
harrykimpel 6a8cd3e
fix spacing add backticks
akristen 2a84d12
fix pathing, add whats new
akristen a33ae78
remove i18n files
akristen bb59e17
updating per logs team sme
akristen 0098e7c
Merge branch 'newrelic:develop' into develop
harrykimpel d9ca9ea
Merge branch 'newrelic:develop' into develop
harrykimpel 82ca940
Merge branch 'newrelic:develop' into develop
harrykimpel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
...linux-installation/container-instrumentation-infrastructure-monitoring-logs.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
title: Container logs configuration for infrastructure monitoring | ||
tags: | ||
- Infrastructure | ||
- Install the infrastructure agent | ||
- Linux installation | ||
metaDescription: New Relic's infrastructure monitoring agent automatically instruments container runtimes to collect container metrics and metadata. | ||
freshnessValidatedDate: never | ||
--- | ||
|
||
import infrastructureAddNamesLogs from 'images/infrastructure_screenshot-crop_add-names-logs.webp' | ||
|
||
import infrastructureAddContainersLogPath from 'images/infrastructure_screenshot-crop_add-containers-log-path.webp' | ||
|
||
import logsParsingUi from 'images/infrastructure_screenshot-full_logs-parsing-ui.webp' | ||
|
||
Our [infrastructure agent](/docs/infrastructure/infrastructure-monitoring/get-started/get-started-infrastructure-monitoring) can gather logs from your containers. When you enable logs from the infrastructure agent, the agent will automatically assign those logs to the hosts running Docker Compose. | ||
|
||
## Requirements [#requirements] | ||
|
||
To collect logs from your containers, you need to have: | ||
|
||
* Infrastructure agent [1.8.32](/docs/release-notes/infrastructure-release-notes/infrastructure-agent-release-notes/new-relic-infrastructure-agent-1832) or higher running on Linux | ||
* CentOS version 6.0 or higher, if you're using CentOS | ||
* Docker with engine from [v1.12](https://docs.docker.com/engine/release-notes/prior-releases/#1120-2016-07-28) or other [`containerd`-based container runtimes](https://kubernetes.io/docs/setup/production-environment/container-runtimes) | ||
|
||
## Collect logs from your containers [#collect-logs] | ||
|
||
1. Open the configuration file for the infrastructure agent and add this snippet: | ||
|
||
```yml | ||
- name: containers | ||
file: /var/lib/docker/containers/*/*.log | ||
``` | ||
|
||
<img | ||
title="Add the containers path to your snippet" | ||
alt="A screenshot that shows where to add this snippet in context of your yaml file" | ||
src={infrastructureAddContainersLogPath} | ||
/> | ||
|
||
* You may find this file at this path: `/etc/newrelic-infra/logging.d/logging.yml`. | ||
* This section directs the agent to collect logs from your containers | ||
|
||
2. Add a tag section to your `docker-compose.yml` that passes in the default `{{.Name}}` attribute: | ||
|
||
```yml | ||
version: '3.9' | ||
x-default-logging: &logging | ||
driver: "json-file" | ||
options: | ||
max-size: "5m" | ||
max-file: "2" | ||
tag: "{{.Name}}" | ||
``` | ||
|
||
<img | ||
title="Configuration file in context" | ||
alt="Screenshot that shows this snippet in context of a configuration file" | ||
src={infrastructureAddNamesLogs} | ||
/> | ||
|
||
This adds a `attrs.tag` attribute to your logs, which looks like this snippet: | ||
|
||
```json | ||
{ | ||
agentName:Infrastructure | ||
agentVersion:1.50.0 | ||
**attrs.tag:cart-service** | ||
coreCount:1 | ||
... | ||
} | ||
``` | ||
|
||
3. Once the `attrs.tag` appears in your host-level logs, you can enable container logs by going to <DoNotTranslate>**[one.newrelic.com](https://one.newrelic.com) > Infrastructure </DoNotTranslate>, then click <DoNotTranslate>**HERE**</DoNotTranslate>. | ||
|
||
4. Create a log parsing rule by applying these configurations: | ||
|
||
* Name: container name | ||
* Field to parse: attrs.tag | ||
* Filter logs based on NRQL: attrs.tag is not null | ||
* Parsing rule: %{NOTSPACE:containerName} | ||
|
||
Your modal should look like this: | ||
|
||
<img | ||
title="Log parsing rules" | ||
alt="Screenshot of log parsing in UI" | ||
src={logsParsingUi} | ||
/> | ||
<figcaption> | ||
|
||
</figcaption> | ||
|
||
5. Generate some data, wait a few minutes, and you'll see container logs assigned to your containers running on your host, rather than assigned to the host itself. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+36.9 KB
src/images/infrastructure_screenshot-crop_add-containers-log-path.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do customers need to have instrumented their containers? Should we instead link them to the other containers dock as a prerequisite? I imagine they can't collect logs about containers w/o having instrumentation first.
@harrykimpel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akristen yes, that is correct. I guess it makes sense to link them to the other containers doc.