[cisco_ftd] Fix 111008/111009 grok to handle usernames with spaces. - #20610
Draft
ie-ops wants to merge 2 commits into
Draft
[cisco_ftd] Fix 111008/111009 grok to handle usernames with spaces.#20610ie-ops wants to merge 2 commits into
ie-ops wants to merge 2 commits into
Conversation
Contributor
✅ Elastic Docs Style Checker (Vale)No issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
Contributor
|
✅ All changelog entries have the correct PR link. |
Contributor
🚀 Benchmarks reportTo see the full report comment with |
💚 Build Succeeded
|
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.
Executive summary
The fix changes two grok patterns for message IDs 111008 and 111009 in the Cisco FTD ingest pipeline, replacing
%{NOTSPACE:server.user.name}with%{DATA:server.user.name}. TheNOTSPACEpattern only matches non-whitespace characters, causing it to fail when usernames contain spaces (e.g.,example-service account). Switching toDATA(which matches any character including spaces, stopping at the next literal delimiter) allows the pipeline to correctly capture multi-word usernames enclosed in single quotes.Proposed commit message
Root cause
The grok patterns for message IDs 111008 and 111009 in
grok_message_e6caac62use%{NOTSPACE:server.user.name}to extract the username from a single-quoted token, but usernames containing whitespace (e.g.example-service account) causeNOTSPACEto fail immediately, making the processor report a grok failure. The fix is to use%{DATA:server.user.name}since the surrounding single quotes already act as the capture boundary.Approach
In the grok processor tagged
grok_message_e6caac62(pipeline line ~405–411), both patterns use%{NOTSPACE:server.user.name}to capture the username between single quotes, but%{NOTSPACE}refuses to match a username likeexample-service accountthat contains a space. Replace%{NOTSPACE:server.user.name}with%{DATA:server.user.name}in both patterns so the match is bounded by the surrounding single-quote literals instead. Add the sanitized event as a new pipeline test fixture and update the expected output.Implementation
packages/cisco_ftd/data_stream/log/elasticsearch/ingest_pipeline/default.yml— in the grok processor taggedgrok_message_e6caac62(lines ~404–411), change both occurrences of%{NOTSPACE:server.user.name}to%{DATA:server.user.name}. Pattern 1 becomes:^%{NOTSPACE} '%{DATA:server.user.name}' executed %{NOTSPACE} %{GREEDYDATA:_temp_.cisco.command_line_arguments}. Pattern 2 becomes:^%{NOTSPACE} '%{DATA:server.user.name}' executed the '%{DATA}' command.packages/cisco_ftd/data_stream/log/_dev/test/pipeline/test-ftd-fix.logas a new line:<181>Jul 7 14:12:01 198.51.100.10 %FTD-5-111008: User 'example-service account' executed the 'show running-config zero-trust' command.packages/cisco_ftd/data_stream/log/_dev/test/pipeline/test-ftd-fix.log-expected.json— includeserver.user.name: 'example-service account',event.code: '111008',related.user: ['example-service account'], and the correct syslog fields parsed from the header.packages/cisco_ftd/manifest.ymlfrom3.13.4to3.13.5.packages/cisco_ftd/changelog.ymlfor version3.13.5with typebugfixdescribing the fix for usernames containing spaces in 111008/111009 messages.elastic-package test pipelineagainst thecisco_ftdpackage to confirm the new fixture passes and no existing fixtures regress.Pipeline changes
grok_message_e6caac62(message IDs 111008, 111009): change%{NOTSPACE:server.user.name}to%{DATA:server.user.name}in both alternative patterns so that usernames containing spaces are correctly captured within their enclosing single quotes.Field / mapping changes
—
Sanitized error message
Processor 'grok' with tag 'grok_message_e6caac62' in pipeline 'logs-cisco_ftd.log-default' failed with message '[on_failure_message]'Sanitized log (
event_sanitizedexcerpt)<181>Jul 7 14:12:01 198.51.100.10 %FTD-5-111008: User 'example-service account' executed the 'show running-config zero-trust' command.Reviewer concerns
executed the '%{DATA}' command) does not capture the command into any field; if capturing that argument is desired, it should be added to both patterns consistently.%{DATA}is greedy up to the next literal anchor — the surrounding single-quote delimiters act as the stop, so this should be safe, but reviewers should confirm no pathological inputs exist where the closing quote is missing or escaped.Self-review findings
—
Risk and classification
Links
394498904ab18c7a