Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Update encoding default (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrod1598 authored May 18, 2021
1 parent 2ccc307 commit 3b22d2e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/operators/file_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The `file_input` operator reads logs from files. It will place the lines read in
| `poll_interval` | 200ms | The duration between filesystem polls |
| `multiline` | | A `multiline` configuration block. See below for details |
| `write_to` | `$body` | The body [field](/docs/types/field.md) written to when creating a new log entry |
| `encoding` | `nop` | The encoding of the file being read. See the list of supported encodings below for available options |
| `encoding` | `utf-8` | The encoding of the file being read. See the list of supported encodings below for available options |
| `include_file_name` | `true` | Whether to add the file name as the attribute `file_name` |
| `include_file_path` | `false` | Whether to add the file path as the label `file_path` |
| `start_at` | `end` | At startup, where to start reading logs from the file. Options are `beginning` or `end` |
Expand Down
2 changes: 1 addition & 1 deletion docs/operators/tcp_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The `tcp_input` operator listens for logs on one or more TCP connections. The op
| `resource` | {} | A map of `key: value` pairs to add to the entry's resource |
| `add_attributes` | false | Adds `net.*` attributes according to [semantic convention][https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/span-general.md#general-network-connection-attributes] |
| `multiline` | | A `multiline` configuration block. See below for details |
| `encoding` | `nop` | The encoding of the file being read. See the list of supported encodings below for available options |
| `encoding` | `utf-8` | The encoding of the file being read. See the list of supported encodings below for available options |

#### TLS Configuration

Expand Down
2 changes: 1 addition & 1 deletion docs/operators/udp_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The `udp_input` operator listens for logs from UDP packets.
| `resource` | {} | A map of `key: value` pairs to add to the entry's resource |
| `add_attributes` | false | Adds `net.*` attributes according to [semantic convention][https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/span-general.md#general-network-connection-attributes] |
| `multiline` | | A `multiline` configuration block. See below for details |
| `encoding` | `nop` | The encoding of the file being read. See the list of supported encodings below for available options |
| `encoding` | `utf-8` | The encoding of the file being read. See the list of supported encodings below for available options |

#### `multiline` configuration

Expand Down
5 changes: 3 additions & 2 deletions operator/helper/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
// NewBasicConfig creates a new Encoding config
func NewEncodingConfig() EncodingConfig {
return EncodingConfig{
Encoding: "nop",
Encoding: "utf-8",
}
}

Expand Down Expand Up @@ -76,11 +76,12 @@ func (e *Encoding) Decode(msgBuf []byte) (string, error) {
var encodingOverrides = map[string]encoding.Encoding{
"utf-16": unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM),
"utf16": unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM),
"utf-8": unicode.UTF8,
"utf8": unicode.UTF8,
"ascii": unicode.UTF8,
"us-ascii": unicode.UTF8,
"nop": encoding.Nop,
"": encoding.Nop,
"": unicode.UTF8,
}

func lookupEncoding(enc string) (encoding.Encoding, error) {
Expand Down

0 comments on commit 3b22d2e

Please sign in to comment.