Repository navigation
[qnap_nas] Fix event log grok for entries without Application/Category. - #20346
Conversation
✅ 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. |
|
✅ All changelog entries have the correct PR link. |
🚀 Benchmarks reportTo see the full report comment with |
💚 Build Succeeded
|
|
Pinging @elastic/integration-experience (Team:Integration-Experience) |
|
No issues across the latest commits 8eb69cc.
🤖 AI-Generated Review | Vera Review Bot | 📚 Knowledge base: integration-skills
|
|
Tick the box to add this pull request to the merge queue (same as
|
|
Package qnap_nas - 1.26.0 containing this change is available at https://epr.elastic.co/package/qnap_nas/1.26.0/ |
Executive summary
A new grok pattern
'^%{SHARED}, Content: %{DATA:message}$'is added to the QNAP NAS ingest pipeline to handle event log entries that omit theApplication:andCategory:fields (e.g., system-internal log archive notifications). Previously, such messages fell through all existing patterns and caused the grok processor to emit a MISSING_CASE failure. The fix adds the pattern in the correct position — after the Application/Category pattern so it does not shadow it — and includes a matching test fixture and expected output. The package version is bumped to 1.26.0.Proposed commit message
Root cause
The grok processor
grok__tmp_message_c75b80dchas two patterns that both require eitherApplication: ... Category: ...orConnection type: ...after the shared prefix, but some QNAP system-internal events (e.g. log archive notifications generated by the System user) emit event log lines that skip those fields and jump directly to, Content: ..., causing both patterns to fail.Approach
Add a third grok pattern to the processor tagged
grok__tmp_message_c75b80dc(default.yml line 62) to handle event log messages that omit the Application and Category fields entirely, going straight from the SHARED block to ', Content: ...'. The new pattern is:^%{SHARED}, Content: %{DATA:message}$. Place it as the third pattern (after the existing Application/Category pattern and before the conn-log pattern would be confused — it only applies to event-log provider, so there is no cross-type risk). The existing Painless script already handles the case where event.action is null and event.provider is event-log by setting category=configuration and type=change, so no script change is needed. Add the sanitized event as a new pipeline test fixture entry with the expected output reflecting the configuration/change ECS categorisation.Implementation
packages/qnap_nas/data_stream/log/elasticsearch/ingest_pipeline/default.yml, add a third grok pattern inside processorgrok__tmp_message_c75b80dc(currently at line 62–71):'^%{SHARED}, Content: %{DATA:message}$'. Insert it as the third entry in thepatternslist, after the existing event-log Application/Category pattern.script_1d15b5b0) already covers the new case: whenevent.action == nullandevent.provider == 'event-log'it setscategory=['configuration']andtype='change'— no change needed to the script.packages/qnap_nas/data_stream/log/_dev/test/pipeline/test-event.log:<30>Jun 27 07:09:00 host-1.example.local qlogd[8212]: event log: Users: System, Source IP: 127.0.0.1, Computer name: host-1.example.local, Content: System Connection Logs archived to backup/example-backup-001.csvpackages/qnap_nas/data_stream/log/_dev/test/pipeline/test-event.log-expected.json. Expected fields:event.provider='event-log',event.kind='event',event.category=['configuration'],event.type='change',message='System Connection Logs archived to backup/example-backup-001.csv',user.name='System',related.user=['System'],host.name='host-1.example.local',process.name='qlogd',process.pid=8212,log.syslog.priority=30,observer.*fields, nosource.ip(127.0.0.1 is excluded by the SHARED pattern), noqnap.nas.application, noqnap.nas.category,tags=['preserve_original_event'].packages/qnap_nas/changelog.ymlas a new1.25.4version with typebugfixdescribing support for event log entries without Application and Category fields.elastic-package test pipeline -C packages/qnap_nasto verify all pipeline tests pass including the new fixture entry.Pipeline changes
grok__tmp_message_c75b80dcin default.yml:'^%{SHARED}, Content: %{DATA:message}$'— placed after the existing Application/Category event-log pattern as a fallback for system-internal event log entries that omit those fieldsField / mapping changes
—
Sanitized error message
Processor 'grok' with tag 'grok__tmp_message_c75b80dc' in pipeline 'logs-qnap_nas.log-default' failed with message '[on_failure_message]'Sanitized log (
event_sanitizedexcerpt)<30>Jun 27 07:09:00 host-1.example.local qlogd[8212]: event log: Users: System, Source IP: 127.0.0.1, Computer name: host-1.example.local, Content: System Connection Logs archived to backup/example-backup-001.csvReviewer concerns
event.category: ["configuration"]andevent.type: "change"values in the expected output for the new test case imply the pipeline's ECS categorization logic assigns a non-trivial default whenqnap.nas.applicationandqnap.nas.categoryare absent; reviewers should trace that logic in the full pipeline YAML to confirm the assignment is intentional and correct.link:value ishttps://github.com/elastic/integrations/pull/1(a placeholder); it must be updated with the real PR number before merging.patternslist could cause regressions.Self-review findings
Self-review invoked: yes (1 cycle)
Final validation passed: yes
Risk and classification
Links
9f09390664cb6f25