# Configuring custom parsers

Use the information on this page to configure custom [parsers](https://docs.fluentbit.io/manual/data-pipeline/parsers).

{% hint style="info" %}
To define a custom parser, add an entry to the [`parsers` section](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/yaml/parsers-section) of your YAML configuration file, or create a [standalone parser file](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/yaml/parsers-section#standalone-parsers-files).
{% endhint %}

## Configuration parameters

Custom parsers support the following configuration parameters:

| Key                    | Description                                                                                                                                                                                                                                                                                                                                                                  | Default |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `decode_field`         | If the content can be decoded in a structured message, append the structured message (keys and values) to the original log message. Decoder types: `json`, `escaped`, `escaped_utf8`, `mysql_quoted`. The syntax is: `decode_field <decoder_type> <field_name>`. See [Decoders](https://docs.fluentbit.io/manual/data-pipeline/parsers/decoders) for additional information. | *none*  |
| `decode_field_as`      | Any decoded content (unstructured or structured) will be replaced in the same key/value, and no extra keys are added. Decoder types: `json`, `escaped`, `escaped_utf8`, `mysql_quoted`. The syntax is: `decode_field_as <decoder_type> <field_name>`. See [Decoders](https://docs.fluentbit.io/manual/data-pipeline/parsers/decoders) for additional information.            | *none*  |
| `format`               | Specifies the format of the parser. Possible options: [`json`](https://docs.fluentbit.io/manual/data-pipeline/parsers/json), [`regex`](https://docs.fluentbit.io/manual/data-pipeline/parsers/regular-expression), [`ltsv`](https://docs.fluentbit.io/manual/data-pipeline/parsers/ltsv), or [`logfmt`](https://docs.fluentbit.io/manual/data-pipeline/parsers/logfmt).      | *none*  |
| `logfmt_no_bare_keys`  | If enabled, the `logfmt` parser rejects log entries where keys don't have associated values (bare keys). Only applies to the `logfmt` format.                                                                                                                                                                                                                                | `false` |
| `name`                 | Sets the name of your parser.                                                                                                                                                                                                                                                                                                                                                | *none*  |
| `regex`                | Required for parsers with the `regex` format. Specifies the Ruby regular expression for parsing and composing the structured message.                                                                                                                                                                                                                                        | *none*  |
| `skip_empty_values`    | Specifies a boolean which determines if the parser should skip empty values.                                                                                                                                                                                                                                                                                                 | `true`  |
| `time_format`          | Specifies the format of the time field so it can be recognized and analyzed properly. Fluent Bit uses `strptime(3)` to parse time. See the [`strptime` documentation](https://linux.die.net/man/3/strptime) for available modifiers. The `%L` field descriptor is supported for fractional seconds.                                                                          | *none*  |
| `time_keep`            | If enabled, when a time key is recognized and parsed, the parser will keep the original time key. If disabled, the parser will drop the original time field.                                                                                                                                                                                                                 | `false` |
| `time_key`             | If the log entry provides a field with a timestamp, this option specifies the name of that field.                                                                                                                                                                                                                                                                            | *none*  |
| `time_offset`          | Specifies a fixed UTC time offset (such as `-0600` or `+0200`) for local dates.                                                                                                                                                                                                                                                                                              | *none*  |
| `time_strict`          | If `true`, the parser is strict with the expected time format. If `false`, the parser is permissive with the format of the time. Set to `false` when the format expects a time fraction but the time to be parsed doesn't include it.                                                                                                                                        | `true`  |
| `time_system_timezone` | If there is no time zone (`%z`) specified in the given `time_format`, enabling this option will make the parser detect and use the system's configured time zone. The configured time zone is detected from the [`TZ` environment variable](https://sourceware.org/glibc/manual/latest/html_node/TZ-Variable.html).                                                          | `false` |
| `types`                | Specifies the data type of a parsed field. The syntax is `types <field_name_1>:<type_name_1> <field_name_2>:<type_name_2> ...`. The supported types are `string` (default), `integer`, `bool`, `float`, `hex`.                                                                                                                                                               | *none*  |

### Time resolution and fractional seconds

Time resolution and its format supported are handled by using the [strftime(3)](https://man7.org/linux/man-pages/man3/strftime.3.html) `libc` system function.

In addition, Fluent Bit extends its time resolution to support fractional seconds like `2017-05-17T15:44:31.187512963Z`. The `%L` format option for `time_format` is provided as a way to indicate that content must be interpreted as fractional seconds.

{% hint style="info" %}
The option `%L` is only valid when used after seconds (`%S`) or seconds since the epoch (`%s`). For example, `%S.%L` and `%s.%L` are valid strings.
{% endhint %}

### Supported time zone abbreviations

The following time zone abbreviations are supported.

#### Universal time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                |
| ------------ | -------------------- | ---------------- | ------ | -------------------------- |
| `GMT`        | `+00:00`             | `0`              | no     | Greenwich Mean Time        |
| `UTC`        | `+00:00`             | `0`              | no     | Coordinated Universal Time |
| `Z`          | `+00:00`             | `0`              | no     | Zulu Time (UTC)            |
| `UT`         | `+00:00`             | `0`              | no     | Universal Time             |

#### North American time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                                             |
| ------------ | -------------------- | ---------------- | ------ | ------------------------------------------------------- |
| `EST`        | `-05:00`             | `-18000`         | no     | Eastern Standard Time                                   |
| `EDT`        | `-04:00`             | `-14400`         | yes    | Eastern Daylight Time                                   |
| `CST`        | `-06:00`             | `-21600`         | no     | Central Standard Time (North America)                   |
| `CDT`        | `-05:00`             | `-18000`         | yes    | Central Daylight Time (North America)                   |
| `MST`        | `-07:00`             | `-25200`         | no     | Mountain Standard Time                                  |
| `MDT`        | `-06:00`             | `-21600`         | yes    | Mountain Daylight Time                                  |
| `PST`        | `-08:00`             | `-28800`         | no     | Pacific Standard Time                                   |
| `PDT`        | `-07:00`             | `-25200`         | yes    | Pacific Daylight Time                                   |
| `AKST`       | `-09:00`             | `-32400`         | no     | Alaska Standard Time                                    |
| `AKDT`       | `-08:00`             | `-28800`         | yes    | Alaska Daylight Time                                    |
| `HST`        | `-10:00`             | `-36000`         | no     | Hawaii Standard Time                                    |
| `HADT`       | `-09:00`             | `-32400`         | yes    | Hawaii-Aleutian Daylight Time (rarely used for Hawaii)  |
| `AST`        | `-04:00`             | `-14400`         | no     | Atlantic Standard Time (for example, Canada, Caribbean) |
| `ADT`        | `-03:00`             | `-10800`         | yes    | Atlantic Daylight Time                                  |
| `NST`        | `-03:30`             | `-12600`         | no     | Newfoundland Standard Time                              |
| `NDT`        | `-02:30`             | `-9000`          | yes    | Newfoundland Daylight Time                              |

#### European time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                  |
| ------------ | -------------------- | ---------------- | ------ | ---------------------------- |
| `WET`        | `+00:00`             | `0`              | no     | Western European Time        |
| `WEST`       | `+01:00`             | `3600`           | yes    | Western European Summer Time |
| `CET`        | `+01:00`             | `3600`           | no     | Central European Time        |
| `CEST`       | `+02:00`             | `7200`           | yes    | Central European Summer Time |
| `EET`        | `+02:00`             | `7200`           | no     | Eastern European Time        |
| `EEST`       | `+03:00`             | `10800`          | yes    | Eastern European Summer Time |
| `MSK`        | `+03:00`             | `10800`          | no     | Moscow Standard Time         |

#### South American time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                                                    |
| ------------ | -------------------- | ---------------- | ------ | -------------------------------------------------------------- |
| `ART`        | `-03:00`             | `-10800`         | no     | Argentina Time                                                 |
| `BRT`        | `-03:00`             | `-10800`         | no     | Brazil Time (main population areas, can vary by region/DST)    |
| `BRST`       | `-02:00`             | `-7200`          | yes    | Brazil Summer Time (historical, not currently observed by all) |
| `CLT`        | `-04:00`             | `-14400`         | no     | Chile Standard Time                                            |
| `CLST`       | `-03:00`             | `-10800`         | yes    | Chile Summer Time                                              |

#### Australasian and Oceania time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                      |
| ------------ | -------------------- | ---------------- | ------ | -------------------------------- |
| `AEST`       | `+10:00`             | `36000`          | no     | Australian Eastern Standard Time |
| `AEDT`       | `+11:00`             | `39600`          | yes    | Australian Eastern Daylight Time |
| `ACST`       | `+09:30`             | `34200`          | no     | Australian Central Standard Time |
| `ACDT`       | `+10:30`             | `37800`          | yes    | Australian Central Daylight Time |
| `AWST`       | `+08:00`             | `28800`          | no     | Australian Western Standard Time |
| `NZST`       | `+12:00`             | `43200`          | no     | New Zealand Standard Time        |
| `NZDT`       | `+13:00`             | `46800`          | yes    | New Zealand Daylight Time        |

#### Asian time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                                        |
| ------------ | -------------------- | ---------------- | ------ | -------------------------------------------------- |
| `JST`        | `+09:00`             | `32400`          | no     | Japan Standard Time                                |
| `KST`        | `+09:00`             | `32400`          | no     | Korea Standard Time                                |
| `SGT`        | `+08:00`             | `28800`          | no     | Singapore Time                                     |
| `IST`        | `+05:30`             | `19800`          | no     | India Standard Time                                |
| `GST`        | `+04:00`             | `14400`          | no     | Gulf Standard Time (for example, UAE, Oman)        |
| `ICT`        | `+07:00`             | `25200`          | no     | Indochina Time (Thailand, Vietnam, Laos, Cambodia) |
| `WIB`        | `+07:00`             | `25200`          | no     | Western Indonesian Time                            |
| `WITA`       | `+08:00`             | `28800`          | no     | Central Indonesian Time                            |
| `WIT`        | `+09:00`             | `32400`          | no     | Eastern Indonesian Time                            |
| `MYT`        | `+08:00`             | `28800`          | no     | Malaysia Time                                      |
| `BDT`        | `+06:00`             | `21600`          | no     | Bangladesh Standard Time                           |
| `NPT`        | `+05:45`             | `20700`          | no     | Nepal Time                                         |

#### African time zones

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                |
| ------------ | -------------------- | ---------------- | ------ | -------------------------- |
| `WAT`        | `+01:00`             | `3600`           | no     | West Africa Time           |
| `CAT`        | `+02:00`             | `7200`           | no     | Central Africa Time        |
| `EAT`        | `+03:00`             | `10800`          | no     | East Africa Time           |
| `SAST`       | `+02:00`             | `7200`           | no     | South Africa Standard Time |

#### Military time zones

{% hint style="info" %}
These are single-letter UTC offset designators. `J` (Juliet) represents local time and isn't included. `Z` represents Zulu Time, as listed in the [Universal time zones](#universal-time-zones) list.
{% endhint %}

| Abbreviation | UTC Offset (`HH:MM`) | Offset (seconds) | Is DST | Description                                          |
| ------------ | -------------------- | ---------------- | ------ | ---------------------------------------------------- |
| `A`          | `+01:00`             | `3600`           | no     | Alpha Time Zone                                      |
| `B`          | `+02:00`             | `7200`           | no     | Bravo Time Zone                                      |
| `C`          | `+03:00`             | `10800`          | no     | Charlie Time Zone                                    |
| `D`          | `+04:00`             | `14400`          | no     | Delta Time Zone                                      |
| `E`          | `+05:00`             | `18000`          | no     | Echo Time Zone                                       |
| `F`          | `+06:00`             | `21600`          | no     | Foxtrot Time Zone                                    |
| `G`          | `+07:00`             | `25200`          | no     | Golf Time Zone                                       |
| `H`          | `+08:00`             | `28800`          | no     | Hotel Time Zone                                      |
| `I`          | `+09:00`             | `32400`          | no     | India Time Zone (military, not Indian Standard Time) |
| `K`          | `+10:00`             | `36000`          | no     | Kilo Time Zone                                       |
| `L`          | `+11:00`             | `39600`          | no     | Lima Time Zone                                       |
| `M`          | `+12:00`             | `43200`          | no     | Mike Time Zone                                       |
| `N`          | `-01:00`             | `-3600`          | no     | November Time Zone                                   |
| `O`          | `-02:00`             | `-7200`          | no     | Oscar Time Zone                                      |
| `P`          | `-03:00`             | `-10800`         | no     | Papa Time Zone                                       |
| `Q`          | `-04:00`             | `-14400`         | no     | Quebec Time Zone                                     |
| `R`          | `-05:00`             | `-18000`         | no     | Romeo Time Zone                                      |
| `S`          | `-06:00`             | `-21600`         | no     | Sierra Time Zone                                     |
| `T`          | `-07:00`             | `-25200`         | no     | Tango Time Zone                                      |
| `U`          | `-08:00`             | `-28800`         | no     | Uniform Time Zone                                    |
| `V`          | `-09:00`             | `-32400`         | no     | Victor Time Zone                                     |
| `W`          | `-10:00`             | `-36000`         | no     | Whiskey Time Zone                                    |
| `X`          | `-11:00`             | `-43200`         | no     | X-ray Time Zone                                      |
| `Y`          | `-12:00`             | `-46800`         | no     | Yankee Time Zone                                     |
