Add support to nanoseconds#165
Merged
kaisecheng merged 9 commits intologstash-plugins:mainfrom Mar 3, 2026
Merged
Conversation
Add unit test classes for CasualISO8601Parser, TAI64NParser, and UnixMillisEpochParser. Expand JodaParserTest and UnixEpochParserTest with year-guessing, DST edge cases, locale, and all input types. Trim DateFilterTest to integration-only tests. Slim date_spec.rb, keeping wiring and Ruby-layer sanity checks.
Introduce a `precision` configuration option ("ms" | "ns", default: "ms")
that controls whether parsed timestamps are stored with millisecond or
nanosecond resolution.
In "ns" mode:
- Custom-pattern formats use java.time-based parsers.
- All formats pass a full java.time.Instant (preserving nanosecond precision)
to the Logstash Timestamp constructor.
- If no timezone is configured, the default falls back to the JVM timezone,
matching the existing joda-time behavior in "ms" mode.
In "ms" mode:
- ISO8601 now accepts up to 9 fractional-second digits (previously limited to 3);
sub-millisecond digits are truncated on write.
- Custom-pattern formats continue to use the joda-time parser.
- Numeric formats are unchanged.
- All formats pass a java.time.Instant truncated to millisecond precision
to preserve the behavior of joda-time's Instant.
donoghuc
requested changes
Mar 3, 2026
donoghuc
left a comment
There was a problem hiding this comment.
Couple small things inline.
Build this in to a logstash container (with 9.3.1 version) and played around with it. It seems good!
Not sure if there are major performance considerations, I may try to poke a that a bit more. :)
src/main/java/org/logstash/filters/parser/CasualISO8601Parser.java
Outdated
Show resolved
Hide resolved
src/test/java/org/logstash/filters/parser/TAI64NParserTest.java
Outdated
Show resolved
Hide resolved
donoghuc
reviewed
Mar 3, 2026
donoghuc
approved these changes
Mar 3, 2026
donoghuc
left a comment
There was a problem hiding this comment.
Thanks for doing the updates in separate commits. That made it super easy to review! This is solid ![]()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add nanosecond precision support via java.time
Introduce a
precisionconfiguration option ("ms" | "ns", default: "ms")that controls whether parsed timestamps are stored with millisecond or
nanosecond resolution.
In "ns" mode:
to the Logstash Timestamp constructor.
matching the existing joda-time behavior in "ms" mode.
In "ms" mode:
sub-millisecond digits are truncated on write.
to preserve the behavior of joda-time's Instant.
Fixes: #161