Skip to content

Commit

Permalink
docs(upgrading): deprecate json_logs (#1377)
Browse files Browse the repository at this point in the history
* docs(upgrading): deprecate json_logs

Signed-off-by: Dominik Rosiek <[email protected]>

* Update docs/upgrading.md

Co-authored-by: Mikołaj Świątek <[email protected]>

* docs: minor fixes

Signed-off-by: Dominik Rosiek <[email protected]>

---------

Signed-off-by: Dominik Rosiek <[email protected]>
Co-authored-by: Mikołaj Świątek <[email protected]>
  • Loading branch information
sumo-drosiek and swiatekm authored Dec 7, 2023
1 parent e32ef7a commit c295cb4
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 0 deletions.
1 change: 1 addition & 0 deletions .changelog/1377.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chore(sumologicexporter): deprecate json_logs
151 changes: 151 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Change configuration for `syslogexporter`](#change-configuration-for-syslogexporter)
- [`sumologic` exporter: deprecate `clear_logs_timestamp`](#sumologic-exporter-deprecate-clear_logs_timestamp)
- [`sumologic` exporter: remove `routing_attributes_to_drop`](#sumologic-exporter-remove-routing_attributes_to_drop)
- [`sumologic` exporter: deprecate `json_logs`](#sumologic-exporter-deprecate-json_logs)
- [Upgrading to v0.89.0-sumo-0](#upgrading-to-v0890-sumo-0)
- [`remoteobserver` processor: renamed to `remotetap` processor](#remoteobserver-processor-renamed-to-remotetap-processor)
- [`sumologic` exporter: changed default `timeout` from `5s` to `30s`](#sumologic-exporter-changed-default-timeout-from-5s-to-30s)
Expand Down Expand Up @@ -161,6 +162,156 @@ exporters:
sumologic:
```

### `sumologic` exporter: deprecate `json_logs`

`json_logs` has been deprecated in favor of `transform` processor. It is going to be removed in `v0.95.0-sumo-0`.

To migrate perform the following steps:

- use `transform` processor in replace of `json_logs.add_timestamp` and `json_logs.timestamp_key`:

```yaml
processors:
transform/add_timestamp:
log_statements:
- context: log
statements:
- set(time, Now()) where time_unix_nano == 0
- set(attributes["timestamp_key"], Int(time_unix_nano / 1000000))
```

- use `transform` processor in replace of `json_logs.flatten_body`:

```yaml
processors:
transform/flatten:
error_mode: ignore
log_statements:
- context: log
statements:
- merge_maps(attributes, body, "insert") where IsMap(body)
- set(body, "") where IsMap(body)
```

- use `transform` processor in replace of `json_logs.log_key`:

```yaml
processors:
transform/set_log_key:
log_statements:
- context: log
statements:
- set(attributes["log"], body)
- set(body, "")
```

#### Migration example for `add_timestamp` and `timestamp_key`

Given the following configuration:

```yaml
exporters:
sumologic:
log_format: json
json_logs:
timestamp_key: timestamp_key
add_timestamp: true
```

change it to:

```yaml
exporters:
sumologic:
log_format: json
json_logs:
add_timestamp: false
processors:
transform/add_timestamp:
log_statements:
- context: log
statements:
- set(time, Now()) where time_unix_nano == 0
- set(attributes["timestamp_key"], Int(time_unix_nano / 1000000))
service:
pipelines:
logs:
processors:
# ...
- transform/add_timestamp
```

#### Migration example for `flatten_body`

Given the following configuration:

```yaml
exporters:
sumologic:
log_format: json
json_logs:
flatten_body: true
```

change it to:

```yaml
exporters:
sumologic:
log_format: json
json_logs:
flatten_body: false
processors:
transform/flatten:
error_mode: ignore
log_statements:
- context: log
statements:
- merge_maps(attributes, body, "insert") where IsMap(body)
- set(body, "") where IsMap(body)
service:
pipelines:
logs:
processors:
# ...
- transform/flatten
```

#### Migration example for `log_key`

Given the following configuration:

```yaml
exporters:
sumologic:
log_format: json
json_logs:
log_key: my_log
```

change it to:

```yaml
exporters:
sumologic:
log_format: json
json_logs:
processors:
transform/set_log_key:
log_statements:
- context: log
statements:
- set(attributes["my_log"], body)
- set(body, "")
service:
pipelines:
logs:
processors:
# ...
- transform/set_log_key
```

## Upgrading to v0.89.0-sumo-0

### `remoteobserver` processor: renamed to `remotetap` processor
Expand Down
5 changes: 5 additions & 0 deletions pkg/exporter/sumologicexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ func initExporter(cfg *Config, createSettings exporter.CreateSettings) (*sumolog
"https://github.com/SumoLogic/sumologic-otel-collector/blob/main/docs/upgrading.md#sumologic-exporter-deprecate-clear_logs_timestamp")
}

if cfg.LogFormat == JSONFormat {
se.logger.Warn("'json_logs' is deprecated and suboptimal. It is going to be removed in 'v0.95.0-sumo-0'. Please follow the upgrade guide: " +
"https://github.com/SumoLogic/sumologic-otel-collector/blob/main/docs/upgrading.md#sumologic-exporter-deprecate-json_logs")
}

return se, nil
}

Expand Down

0 comments on commit c295cb4

Please sign in to comment.