Skip to content

Conversation

@chrisberkhout
Copy link
Contributor

@chrisberkhout chrisberkhout commented Jan 28, 2025

Proposed commit message

[cisco_duo] Avoid obsolete cursor data in activity, telephony_v2 In an earlier version of the CEL code for `activity`[1] and `telephony_v2`[2], `cursor.last_published` was set to a UNIX timestamp value. This was changed to use RFC3339 formatted times in later PRs[3][4] (with the corresponding read-time parsing added in [5]). Users who didn't create a new policy may have the current parsing logic fail when it encounters an old UNIX timestamp value in `cursor.last_published`. This PR addresses that issue by renaming `cursor.last_published` to `cursor.last_response_ts`. That effectively clears the cursor so that obsolete values will not be seen. [1]: https://github.com/elastic/integrations/blob/2ea993/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs#L111-L114 [2]: https://github.com/elastic/integrations/blob/2ea993/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs#L112-L115 [3]: https://github.com/elastic/integrations/pull/11640 [4]: https://github.com/elastic/integrations/pull/11670 [5]: https://github.com/elastic/integrations/pull/11772 

Discussion

The API documentation's description of the ts field remains consistent with #11772.

An alternative to this PR would be to parse both legacy and new data, as follows:

diff --git a/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs b/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs index c03f4a1ed3..ffea8d42de 100644 --- a/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs +++ b/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs @@ -39,7 +39,10 @@ program: | state.with({ "mintime": string(1000 * int( state.?cursor.last_published.optMap(t, - t.parse_time(time_layout.RFC3339Nano) + !is_error(int(t)) ? + timestamp(int(t)/1000)+duration(string(int(t)%1000)+"ms") + : + t.parse_time(time_layout.RFC3339Nano) ).orValue( now - duration(state.initial_interval) ) diff --git a/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs b/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs index 553258248b..000c160d67 100644 --- a/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs +++ b/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs @@ -39,7 +39,10 @@ program: | state.with({ "mintime": string(1000 * int( state.?cursor.last_published.optMap(t, - t.parse_time(time_layout.RFC3339Nano) + !is_error(int(t)) ? + timestamp(int(t)/1000)+duration(string(int(t)%1000)+"ms") + : + t.parse_time(time_layout.RFC3339Nano) ).orValue( now - duration(state.initial_interval) )

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.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Related issues

@chrisberkhout chrisberkhout added Integration:cisco_duo Cisco Duo bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Jan 28, 2025
@chrisberkhout chrisberkhout self-assigned this Jan 28, 2025
@chrisberkhout chrisberkhout requested a review from a team as a January 28, 2025 06:43
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

The naming here makes me feel a little icky; last_published_ts or last_response_ts?

@chrisberkhout
Copy link
Contributor Author

The naming here makes me feel a little icky; last_published_ts or last_response_ts?

Sure. Now it's last_response_ts.

@chrisberkhout chrisberkhout requested a review from efd6 January 28, 2025 10:18
@elasticmachine
Copy link

💚 Build Succeeded

History

  • 💚 Build #21054 succeeded 335ef0e7ceff3044d56e27997936c53c525c9880

cc @chrisberkhout

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Thanks

@chrisberkhout chrisberkhout merged this pull request into elastic:main Jan 28, 2025
5 checks passed
@elastic-vault-github-plugin-prod

Package cisco_duo - 2.3.2 containing this change is available at https://epr.elastic.co/package/cisco_duo/2.3.2/

harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 4, 2025
…stic#12492) In an earlier version of the CEL code for `activity`[1] and `telephony_v2`[2], `cursor.last_published` was set to a UNIX timestamp value. This was changed to use RFC3339 formatted times in later PRs[3][4] (with the corresponding read-time parsing added in [5]). Users who didn't create a new policy may have the current parsing logic fail when it encounters an old UNIX timestamp value in `cursor.last_published`. This PR addresses that issue by renaming `cursor.last_published` to `cursor.last_response_ts`. That effectively clears the cursor so that obsolete values will not be seen. [1]: https://github.com/elastic/integrations/blob/2ea993/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs#L111-L114 [2]: https://github.com/elastic/integrations/blob/2ea993/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs#L112-L115 [3]: elastic#11640 [4]: elastic#11670 [5]: elastic#11772
harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 5, 2025
…stic#12492) In an earlier version of the CEL code for `activity`[1] and `telephony_v2`[2], `cursor.last_published` was set to a UNIX timestamp value. This was changed to use RFC3339 formatted times in later PRs[3][4] (with the corresponding read-time parsing added in [5]). Users who didn't create a new policy may have the current parsing logic fail when it encounters an old UNIX timestamp value in `cursor.last_published`. This PR addresses that issue by renaming `cursor.last_published` to `cursor.last_response_ts`. That effectively clears the cursor so that obsolete values will not be seen. [1]: https://github.com/elastic/integrations/blob/2ea993/packages/cisco_duo/data_stream/activity/agent/stream/cel.yml.hbs#L111-L114 [2]: https://github.com/elastic/integrations/blob/2ea993/packages/cisco_duo/data_stream/telephony_v2/agent/stream/cel.yml.hbs#L112-L115 [3]: elastic#11640 [4]: elastic#11670 [5]: elastic#11772
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:cisco_duo Cisco Duo Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

3 participants