Skip to content

Commit

Permalink
Clarify usage of custom timestamp format (#1267)
Browse files Browse the repository at this point in the history
* Clarify usage of custom timestamp format

* Apply suggestions from code review

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>

* Fix example

---------

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
  • Loading branch information
ptodev and clayton-cornell authored Jul 12, 2024
1 parent e4aabe3 commit 12b206b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/sources/reference/components/loki/loki.process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1475,9 +1475,14 @@ custom format.
| Fraction of second | .000 (ms zero prefixed), .000000 (μs), .000000000 (ns), .999 (ms without trailing zeroes), .999999 (μs), .999999999 (ns) |
| 12-hour period | pm, PM |
| Timezone name | MST |
| Timezone offset | -0700, -070000 (with seconds), -07, 07:00, -07:00:00 (with seconds) |
| Timezone offset | -0700, -070000 (with seconds), -07, -07:00, -07:00:00 (with seconds) |
| Timezone ISO-8601 | Z0700 (Z for UTC or time offset), Z070000, Z07, Z07:00, Z07:00:00 |

{{< admonition type="note" >}}
If you define a custom timestamp, the `format` value for each timestamp component must be one of the values specified in the table above.
For example, to indicate the year, the `format` value must be `06` or `2006` and not any other value like `23` or `2023`.
{{< /admonition >}}

The `fallback_formats` field defines one or more format fields to try and parse
the timestamp with, if parsing with `format` fails.

Expand All @@ -1504,6 +1509,15 @@ stage.timestamp {
}
```

The following example would parse a timestamp such as `2024-12-20T09:14:58,381+02:00`:

```alloy
stage.timestamp {
source = "time"
format = "2006-01-02T15:04:05,000-07:00"
}
```

### stage.geoip block

The `stage.geoip` inner block configures a processing stage that reads an IP address and populates the shared map with geoip fields. Maxmind’s GeoIP2 database is used for the lookup.
Expand Down

0 comments on commit 12b206b

Please sign in to comment.