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

[bug][filebeat] regular expression has redundant nested repeat operator for system.auth.timestamp #34249

Closed
brsolomon-deloitte opened this issue Jan 12, 2023 · 4 comments · Fixed by #34550
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@brsolomon-deloitte
Copy link
Contributor

Here's a fun one.

{"@timestamp":"2023-01-12T01:24:02.732Z", "log.level": "WARN", "message":"regular expression has redundant nested repeat operator * /^(?<TIMESTAMP:system.auth.timestamp>(?:(?:(?:(?>\\d\\d){1,2})-(?:(?:0?[1-9]|1[0-2]))-(?:(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9]))[T ](?:(?:2[0123]|[01][0-9])):?(?:(?:[0-5][0-9]))(?::?(?:(?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)))?(?:(?:Z|[+-](?:(?:2[0123]|[01]?[0-9]))(?::?(?:(?:[0-5][0-9])))))?)|(?:(?:\\b(?:[Jj]an(?:uary|uar)?|[Ff]eb(?:ruary|ruar)?|[Mm](?:a|ä)?r(?:ch|z)?|[Aa]pr(?:il)?|[Mm]a(?:y|i)?|[Jj]un(?:e|i)?|[Jj]ul(?:y|i)?|[Aa]ug(?:ust)?|[Ss]ep(?:tember)?|[Oo](?:c|k)?t(?:ober)?|[Nn]ov(?:ember)?|[Dd]e(?:c|z)(?:ember)?)\\b) +(?:(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])) (?:(?!<[0-9])(?:(?:2[0123]|[01]?[0-9])):(?:(?:[0-5][0-9]))(?::(?:(?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)))(?![0-9]))))) (?<SYSLOGHOST:host.hostname>(?:(?:(?:(?:(?:((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([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(?:(?<![0-9])(?:(?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]))(?![0-9]))))|(?:\\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\\.?|\\b)))))? (?<DATA:process.name>.*?)(?:\\[(?<POSINT:process.pid:long>\\b(?:[1-9][0-9]*)\\b)\\])?:(?:\\s*)+(?<GREEDYMULTILINE:_temp.message>(.|\\n)*)$/", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[elastic8-es-default-0][clusterApplierService#updateTask][T#1]","log.logger":"org.elasticsearch.ingest.common.GrokProcessor","elasticsearch.node.name":"elastic8-es-default-0","elasticsearch.cluster.name":"elastic8"}

Caused by: https://github.com/elastic/beats/blob/main/filebeat/module/system/auth/ingest/pipeline.yml e.g. filebeat-8.5.3-system-auth-pipeline

Related to: #15900, #15840

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 12, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 13, 2023
@belimawr belimawr added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team and removed Team:Security-External Integrations labels Jan 13, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@TotalKnob
Copy link
Contributor

(One of) the redundant operator can be attributed to the pattern %{SPACE}+, resulting in the regex (?:\s*)+ which has indeed a redundant operator. Removing the + will produce the exact same result from the pattern but eliminates the redundant operator. PR in #34550

@brsolomon-deloitte
Copy link
Contributor Author

Nice find @TotalKnob . Like a needle in a haystack :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants