Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Performance improvements related to ECS Grok pattern usage #89424

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ public final class TimestampFormatFinder {
*/
static final List<CandidateTimestampFormat> ORDERED_CANDIDATE_FORMATS_ECS_V1;
static {
// From libs/grok/src/main/resources/patterns/ecs-v1/java
// TOMCAT_DATESTAMP (?:%{CATALINA8_DATESTAMP})|(?:%{CATALINA7_DATESTAMP})|(?:%{TOMCATLEGACY_DATESTAMP})

List<CandidateTimestampFormat> items = new ArrayList<>();
// CATALINA8_DATESTAMP %{MONTHDAY}-%{MONTH}-%{YEAR} %{HOUR}:%{MINUTE}:%{SECOND}
// Where SECOND is defined as (?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)
Expand Down Expand Up @@ -325,11 +328,30 @@ public final class TimestampFormatFinder {
3
)
);
// From libs/grok/src/main/resources/patterns/ecs-v1/java
// TOMCATLEGACY_DATESTAMP %{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND}(?: %{ISO8601_TIMEZONE})?
// This is effectively a renaming of TOMCAT_DATESTAMP defined in libs/grok/src/main/resources/patterns/legacy/java
items.add(
new CandidateTimestampFormat(
example -> CandidateTimestampFormat.iso8601LikeFormatFromExample(example, " ", " "),
"\\b\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}[:.,]\\d{3}",
"\\b20\\d{2}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:?%{MINUTE}:(?:[0-5][0-9]|60)[:.,][0-9]{3,9} (?:Z|[+-]%{HOUR}%{MINUTE})\\b",
"TOMCATLEGACY_DATESTAMP",
"1111 11 11 11 11 11 111",
0,
13
)
);

items.addAll(
ORDERED_CANDIDATE_FORMATS.stream()
.filter(p -> "CATALINA_DATESTAMP".equals(p.outputGrokPatternName) == false)
.filter(
p -> (("CATALINA_DATESTAMP".equals(p.outputGrokPatternName) == false)
&& ("TOMCAT_DATESTAMP".equals(p.outputGrokPatternName) == false))
)
.collect(Collectors.toList())
);

ORDERED_CANDIDATE_FORMATS_ECS_V1 = Collections.unmodifiableList(items);
}

Expand Down
Loading