Skip to content

citrix_adc: fix ICASTART Grok pattern for empty customername and trailing \r - #20518

Open
Niceplace wants to merge 7 commits into
mainfrom
fix/citrix-adc-icastart-grok-double-space
Open

citrix_adc: fix ICASTART Grok pattern for empty customername and trailing \r#20518
Niceplace wants to merge 7 commits into
mainfrom
fix/citrix-adc-icastart-grok-double-space

Conversation

@Niceplace

Copy link
Copy Markdown
Contributor

Summary

Fixes a Grok parse failure in the grok_sslvpn_icastart processor within the sslvpn_and_aaatm_feature pipeline.

Two scenarios caused the pattern to fail on valid ICASTART log events:

  • Empty customername (double space): When customername is absent, the network appliance logs customername - (two spaces before the dash). The previous pattern placed the optional space inside the capture group — customername( %{WORD})? — so when the group was skipped only one space was expected, causing a mismatch.
  • Trailing carriage return (\r): Network appliances sometimes append \r to log lines. The previous end-of-pattern anchor ?$ only handled 0–1 trailing spaces and could not absorb \r.

Fix:

  • customername( %{WORD:...})? - customername(?:%{SPACE}%{WORD:...})?%{SPACE}- — moves the separator whitespace outside the optional group so any number of spaces is accepted whether or not a name is present.
  • ?$%{SPACE}$ — absorbs trailing \r and multiple spaces via \s*.

Test coverage

Added a regression test case to test-citrix-waf-native.log matching the exact customer-reported log format: ICASTART event with SSLRelayAddress, empty customername, and the $P1018 application name suffix.

Checklist

  • Pipeline test added for the failing log format
  • All existing pipeline tests pass
  • elastic-package format and elastic-package lint clean
  • Version bumped to 1.18.6
  • Changelog entry added

@Niceplace
Niceplace requested review from a team as code owners August 4, 2026 14:08
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
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.

…ling \r

The grok_sslvpn_icastart pattern failed on ICASTART events where
customername was absent (producing two consecutive spaces) and on events
with a trailing carriage return from network appliances.

- Replace `( %{WORD})?` with `(?:%{SPACE}%{WORD})?%{SPACE}` so the
  separator whitespace is flexible regardless of whether customername is
  present or absent.
- Replace trailing ` ?$` with `%{SPACE}$` to absorb \r and other
  trailing whitespace.

Adds a regression test case matching the customer-reported log format.
@Niceplace
Niceplace force-pushed the fix/citrix-adc-icastart-grok-double-space branch from 87b9484 to 4fc37b7 Compare August 4, 2026 14:22
Extends the remove_newlines gsub from stripping only \n to stripping
both \r and \n so that trailing CR from network appliances does not
reach sub-pipeline Grok patterns.
Oct 6 14:03:23 <local0.info> 81.2.69.144 10/06/2014:14:03:23 GMT ns1 0-PPE-0 : SSLVPN LOGIN 4471 0 : User JohnDoe - Client_ip 192.168.1.50 - Nat_ip 10.0.0.50 - Vserver 1.128.0.0:443 - Browser_type "Chrome" - SSLVPN_client_type NetScalerPlugin - Group(s) "IT,RemoteWorkers"
Oct 6 14:03:23 <local0.info> 81.2.69.144 10/06/2014:14:03:23 GMT ns1 0-PPE-0 : SSLVPN LOGOUT 4471 0 : User JaneSmith - Client_ip 192.168.1.51 - Nat_ip 10.0.0.51 - Vserver 1.128.0.0:10443 - Start_time "2023-04-01T08:00:00Z" - End_time "2023-04-01T12:00:00Z" - Duration 00:00:04 - Http_resources_accessed 15 - NonHttp_services_accessed 5 - Total_TCP_connections 20 - Total_UDP_flows 10 - Total_policies_allowed 25 - Total_policies_denied 5 - Total_bytes_send 1 - Total_bytes_recv 500 - Total_compressedbytes_send 700 - Total_compressedbytes_recv 350 - Compression_ratio_send 50.00% - Compression_ratio_recv 70.00% - LogoutMethod "Timeout" - Group(s) "HR,Finance"
Oct 6 14:03:23 <local0.info> 81.2.69.144 10/06/2014:14:03:23 GMT ns1 0-PPE-0 : SSLVPN ICASTART 4471 0 : Source 192.168.1.52:5060 - Destination 1.128.0.0:80 - SSLRelayAddress 10.0.0.52:443 - customername AcmeCorp - username:domainname someusername:example.domain.com - applicationName WebMail - startTime "2023-04-01T09:00:00Z" - connectionId 9a8b7c
Oct 6 14:03:23 <local0.info> 81.2.69.144 07/20/2026:15:59:08 GMT ns1 0-PPE-3 : default SSLVPN ICASTART 18346082 0 : Source 10.0.0.1:12345 - Destination 192.168.1.1:80 - SSLRelayAddress 172.16.0.1:443 - customername - username:domainname user.name:example - applicationName WebApp-Desktop $P0000 - startTime "07/20/2026:15:59:08 GMT" - connectionId 805bbd

@Niceplace Niceplace Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: It does not seem possible to explicitly test for trailing or leading carriage return/line feeds given that these characters are stripped by elastic-package's usage of scanners which ends up triggering ScanLines. To quote from golan's docs

ScanLines is a split function for a Scanner that returns each line of text, stripped of any trailing end-of-line marker.

Because of this constraint, adding a newline/carriage return in a .log file will never get reflected in the generated *-expected.json. This is why the gsub processor was updated in https://github.com/elastic/integrations/pull/20518/changes#diff-432e39fad6ef3555d161b12b18065b691ce2661855fa805e7ad73060bd48e7b7R30 which guarantees we won't have any newlines or carriage-returns anywhere.

@Niceplace Niceplace self-assigned this Aug 4, 2026
@Niceplace Niceplace added Integration:citrix_adc Citrix ADC bugfix Pull request that fixes a bug issue labels Aug 4, 2026
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

✅ All changelog entries have the correct PR link.

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

Package citrix_adc 👍(3) 💚(2) 💔(1)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
system 6329.11 4504.5 -1824.61 (-28.83%) 💔

To see the full report comment with /test benchmark fullreport

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @Niceplace

@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue Integration:citrix_adc Citrix ADC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants