Skip to content

Commit

Permalink
Merge pull request #8073 from iamemilio/golang-logs-in-context
Browse files Browse the repository at this point in the history
golang logs in context (ETA 06-29-22)
  • Loading branch information
barbnewrelic committed Jun 29, 2022
2 parents 99beff6 + 7f4bcb9 commit afde839
Show file tree
Hide file tree
Showing 5 changed files with 377 additions and 16 deletions.
Expand Up @@ -1749,7 +1749,7 @@ When distributed tracing is enabled, you can collect [span events](/docs/apm/dis
</th>

<td>
`false`
`true`
</td>
</tr>

Expand Down Expand Up @@ -1972,3 +1972,206 @@ To enable Infinite Tracing, enable distributed tracing (set `config.DistributedT
For help getting a valid Infinite Tracing trace observer host entry, see [Find or create a trace observer endpoint](/docs/understand-dependencies/distributed-tracing/enable-configure/language-agents-enable-distributed-tracing#provision-trace-observer).
</dd>
</CollapserGroup>

## Application logging settings [#application-logging]

The following settings are available for configuration of application logging in the agent.

<Callout variant="important">
Requires Go agent version 3.17.0 or higher
</Callout>

<CollapserGroup>
<Collapser
id="application-logging-enabled"
title="ApplicationLogging.Enabled"
>
<table>
<tbody>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>

<tr>
<th>
Default
</th>

<td>
`true`
</td>
</tr>

<tr>
<th>
[Set in](#options)
</th>

<td>
`newrelic.Config` struct
</td>
</tr>
</tbody>
</table>
If `true`, enables the collection of log events and logging metrics if these sub-feature configurations are also enabled. If `false`, no logging instrumentation features are enabled.

Configure ApplicationLogging by calling ConfigAppLogEnabled().

```go
app, err := newrelic.NewApplication(
newrelic.ConfigAppLogEnabled(true),
)
```
</Collapser>

<Collapser
id="application-logging-forwarding-enabled"
title="ApplicationLogging.Forwarding.Enabled"
>
<table>
<tbody>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>

<tr>
<th>
Default
</th>

<td>
`false`
</td>
</tr>

<tr>
<th>
[Set in](#options)
</th>

<td>
`newrelic.Config` struct
</td>
</tr>
</tbody>
</table>

If `true`, the agent captures log records emitted by your application and forwards them to New Relic. `ApplicationLogging.Enabled` must also be `true` for this setting to take effect.

Enable log forwarding by calling ConfigAppLogForwardingEnabled().

```go
app, err := newrelic.NewApplication(
newrelic.ConfigAppLogForwardingEnabled(true),
)
```
</Collapser>

<Collapser
id="application-logging-forwarding-maximum-samples-stored"
title="ApplicationLogging.Forwarding.MaxSamplesStored"
>
<table>
<tbody>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>

<tr>
<th>
Default
</th>

<td>
10000
</td>
</tr>

<tr>
<th>
[Set in](#options)
</th>

<td>
`newrelic.Config` struct
</td>
</tr>

</tbody>
</table>

Number of log records to send per minute to New Relic. This setting controls overall memory consumption when using the log forwarding feature.

Configure ApplicationLogging.Forwarding.MaxSamplesStored by calling ConfigAppLogForwardingMaxSamplesStored().

```go
app, err := newrelic.NewApplication(
newrelic.ConfigAppLogForwardingMaxSamplesStored(1000),
)
```

</Collapser>

<Collapser
id="application-logging-metrics-enabled"
title="ApplicationLogging.Metrics.Enabled"
>
<table>
<tbody>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>

<tr>
<th>
Default
</th>

<td>
`true`
</td>
</tr>

<tr>
<th>
[Set in](#options)
</th>

<td>
`newrelic.Config` struct
</td>
</tr>
</tbody>
</table>

If `true`, the agent captures metrics related to the log lines being sent up by your application. `ApplicationLogging.Enabled` must also be `true` for this setting to take effect.

Configure ApplicationLogging.Metrics.Enabled by calling ConfigAppLogMetricsEnabled().

```go
app, err := newrelic.NewApplication(
newrelic.ConfigAppLogConfigAppLogMetricsEnabled(true),
)
```
</Collapser>
</CollapserGroup>
Expand Up @@ -62,6 +62,7 @@ Our latest APM agents support automatically adding context and forwarding logs w

Not every language or logging framework is supported yet. The following are our currently supported environments, with links to language-specific documentation:

* [Go logs in context procedures](/docs/logs/logs-context/configure-logs-context-go) for agent [v3.17.0 or higher](/docs/release-notes/agent-release-notes/go-release-notes)
* [Java logs in context procedures](/docs/logs/logs-context/java-configure-logs-context-all) for agent [v7.6.0 or higher](/docs/release-notes/agent-release-notes/java-release-notes)
* [.NET logs in context procedures](/docs/logs/logs-context/net-configure-logs-context-all) for agent [v9.8.0 or higher](/docs/release-notes/agent-release-notes/net-release-notes)
* [Node.js logs in context procedures](/docs/logs/logs-context/configure-logs-context-nodejs) for agent [v8.11.0 or higher](/docs/release-notes/agent-release-notes/nodejs-release-notes)
Expand Down

0 comments on commit afde839

Please sign in to comment.