Skip to content

[Cisco Secure Email Gateway] Fix for grok if hostname appears before category.name in Cisco secure email gateway package#9160

Merged
norrietaylor merged 1 commit intoelastic:mainfrom
norrietaylor:norrietaylor/sdhbeats4375
Feb 16, 2024
Merged

[Cisco Secure Email Gateway] Fix for grok if hostname appears before category.name in Cisco secure email gateway package#9160
norrietaylor merged 1 commit intoelastic:mainfrom
norrietaylor:norrietaylor/sdhbeats4375

Conversation

@norrietaylor
Copy link
Member

@norrietaylor norrietaylor commented Feb 15, 2024

Proposed commit message

Fix for grok if hostname appears before category.name in Cisco secure email gateway package

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Related issues

@norrietaylor norrietaylor requested a review from a team as a code owner February 15, 2024 02:59
@norrietaylor norrietaylor changed the title [bug] Fix for grok if hostname appears before category.name [bug] Fix for grok if hostname appears before category.name in Cisco secure email gateway package Feb 15, 2024
@norrietaylor norrietaylor force-pushed the norrietaylor/sdhbeats4375 branch from 7bb5123 to f95d612 Compare February 15, 2024 03:15
@norrietaylor norrietaylor force-pushed the norrietaylor/sdhbeats4375 branch from f95d612 to 4131f79 Compare February 15, 2024 03:29
@elasticmachine
Copy link

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link

💚 Build Succeeded

History

  • 💔 Build #8979 failed f95d6129838681e72baea69e70a4380b4ec6aa9a
  • 💔 Build #8978 failed 7bb512363336a288fd8a19e3b619cf762a0da916

@elastic-sonarqube
Copy link

@norrietaylor norrietaylor changed the title [bug] Fix for grok if hostname appears before category.name in Cisco secure email gateway package [Cisco Secure Email Gateway] Fix for grok if hostname appears before category.name in Cisco secure email gateway package Feb 15, 2024
@norrietaylor norrietaylor added the Integration:cisco_secure_email_gateway Cisco Secure Email Gateway label Feb 15, 2024
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

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

LGTM

patterns:
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} %{DATA:cisco_secure_email_gateway.log.category.name}: %{WORD:log.level}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} %{DATA:cisco_secure_email_gateway.log.category.name}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} (?:%{HOSTNAME:cisco_secure_email_gateway.log.host} )?%{DATA:cisco_secure_email_gateway.log.category.name}: %{WORD:log.level}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
Copy link
Contributor

Choose a reason for hiding this comment

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

As an aside, and I don't think this is a problem here based on the patterns I'm seeing, but the HOSTNAME grok pattern can match against all numbers ([0-9]+). I had a problem with this in the Cisco IOS package where pattern matches were short-circuiting due to that loose HOSTNAME pattern. At least the header variations here seem to be a bit more concise. There were at least 20 different header variations that I counted in the IOS package.

patterns:
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} %{DATA:cisco_secure_email_gateway.log.category.name}: %{WORD:log.level}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} %{DATA:cisco_secure_email_gateway.log.category.name}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
- '^(?:<%{NUMBER:log.syslog.priority:long}>)?%{SYSLOGTIMESTAMP:_tmp.timestamp} (?:%{HOSTNAME:cisco_secure_email_gateway.log.host} )?%{DATA:cisco_secure_email_gateway.log.category.name}: %{WORD:log.level}: %{GREEDYDATA:cisco_secure_email_gateway.log.message}$'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also wondering if we should set log.syslog.hostname first, then copy it to cisco_secure_email_gateway.log.host in a separate processor.
https://www.elastic.co/guide/en/ecs/current/ecs-log.html#field-log-syslog-hostname

The risk I could see here is if that hostname isn't the actual hostname of the device (i.e., it's the hostname of a syslog collector).

Copy link
Contributor

Choose a reason for hiding this comment

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

After thinking about this some more, let's go with cisco_secure_email_gateway.log.host for now. Based on the sample logs in the package, if an event comes in through a log file, it will no longer have the syslog header, so the scenario I'm thinking of shouldn't happen. No actions/changes needed for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thanks for digging deeper, @taylor-swanson. In the meantime, I have requested some more information in the SDH to verify that this is, indeed, the Cisco device hostname. I will merge this once that verification is complete.

Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed with the customer that this is, in fact, the Cisco device.

@norrietaylor norrietaylor merged commit d72cb49 into elastic:main Feb 16, 2024
@norrietaylor norrietaylor deleted the norrietaylor/sdhbeats4375 branch February 16, 2024 16:29
@elasticmachine
Copy link

Package cisco_secure_email_gateway - 1.22.2 containing this change is available at https://epr.elastic.co/search?package=cisco_secure_email_gateway

gizas pushed a commit that referenced this pull request Mar 13, 2024
…category.name in Cisco secure email gateway package #9160)
qcorporation pushed a commit that referenced this pull request Feb 3, 2025
…category.name in Cisco secure email gateway package #9160)
qcorporation pushed a commit that referenced this pull request Feb 4, 2025
…category.name in Cisco secure email gateway package #9160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration:cisco_secure_email_gateway Cisco Secure Email Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants