[cisco_ftd] Fix grok for 111008/111009 to capture usernames with spaces. - #20563
Draft
ie-ops wants to merge 2 commits into
Draft
[cisco_ftd] Fix grok for 111008/111009 to capture usernames with spaces.#20563ie-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. |
💚 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 grok patterns for Cisco FTD message codes 111008 and 111009 used
%{NOTSPACE}to capture the username field (server.user.name), which excludes whitespace and therefore fails to parse usernames containing spaces (e.g., service accounts likeexample-service account). The fix replaces%{NOTSPACE}with%{DATA}in both patterns, allowing the username to contain spaces while still being correctly bounded by the surrounding single quotes. A new pipeline test fixture was added to validate the space-containing username case, and the package version was bumped to 3.13.9.Proposed commit message
Root cause
The
grok_message_e6caac62processor uses%{NOTSPACE:server.user.name}(regex\S+) to capture the username from 111008/111009 messages, which stops at the first whitespace character. Cisco FTD allows service accounts and domain accounts with embedded spaces in their names, causing the pattern to fail mid-match and the processor to throw a parse error.Approach
In the
grok_message_e6caac62processor (which handles message IDs 111008 and 111009), replace%{NOTSPACE:server.user.name}with%{DATA:server.user.name}in both grok patterns. The username is already delimited on both sides by literal single-quote characters, soDATA(which matches any character including spaces) is safely bounded and will correctly capture multi-word usernames such as service accounts and domain accounts. Add a pipeline test fixture for the sanitized event to validate the corrected patterns. Bump package version from 3.13.4 to 3.13.5 with a bugfix changelog entry.Implementation
packages/cisco_ftd/data_stream/log/elasticsearch/ingest_pipeline/default.yml— in thegrok_message_e6caac62processor (line ~410), change pattern 1 from^%{NOTSPACE} '%{NOTSPACE:server.user.name}' executed %{NOTSPACE} %{GREEDYDATA:_temp_.cisco.command_line_arguments}to^%{NOTSPACE} '%{DATA:server.user.name}' executed %{NOTSPACE} %{GREEDYDATA:_temp_.cisco.command_line_arguments}packages/cisco_ftd/data_stream/log/elasticsearch/ingest_pipeline/default.yml— in the samegrok_message_e6caac62processor (line ~411), change pattern 2 from^%{NOTSPACE} '%{NOTSPACE:server.user.name}' executed the '%{DATA}' commandto^%{NOTSPACE} '%{DATA:server.user.name}' executed the '%{DATA}' commandpackages/cisco_ftd/data_stream/log/_dev/test/pipeline/test-ftd-fix.log:<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— add the expected output entry for the new event withserver.user.name: "example-service account",event.code: "111008",_temp_.cisco.command_line_arguments: "show running-config zero-trust", andrelated.usercontaining"example-service account"(the existingappend_related_user_6a92751cprocessor at line ~3104 already handles this append forserver.user.name)packages/cisco_ftd/changelog.yml— prepend a new entry for version3.13.5withtype: bugfixand description:Fix grok pattern for messages 111008 and 111009 to capture usernames containing spaces.packages/cisco_ftd/manifest.yml— bumpversionfrom3.13.4to3.13.5elastic-package test pipeline --data-streams logfrompackages/cisco_ftd/to validate all test fixtures passPipeline changes
%{NOTSPACE:server.user.name}with%{DATA:server.user.name}— username is bounded by surrounding single-quote delimiters so DATA cannot over-capture%{NOTSPACE:server.user.name}with%{DATA:server.user.name}— same bounding rationale appliesField / mapping changes
—
Sanitized error message
[pipeline error]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
test-ftd-fix.log) is missing a trailing newline (\ No newline at end of file); minor style issue that some CI linters flag.%{GREEDYDATA}forcommand_line_argumentsafter%{DATA}for the username — both rely on the single-quote delimiters being well-formed in the log message. If a username itself contained a literal single quote,DATA(non-greedy.*?) would stop at the first'and potentially misparse; this edge case is unlikely in practice but worth noting.Self-review findings
—
Risk and classification
Links
394498904ab18c7a