Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace timestamp with time & Add document for GraphQL API connRawEvents #918

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sophie-cluml
Copy link
Contributor

@sophie-cluml sophie-cluml commented Dec 3, 2024

Close: #917
Close: #922


Below was a description in PR draft stage:

Hi @sehkone, I’ve created this draft PR to ask for your confirmation if I’m heading in the right direction. So far, I’ve only worked on the connRawEvents GraphQL API as a single case example. If the approach aligns with your expectations, I can proceed to apply the same methodology to the remaining GraphQL APIs. Let me know your thoughts.

GraphQL Playground looks like below:

image

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 69.34307% with 126 lines in your changes missing coverage. Please review.

Project coverage is 77.27%. Comparing base (ffef4d1) to head (96fb059).

Files with missing lines Patch % Lines
src/graphql/sysmon.rs 0.00% 61 Missing ⚠️
src/graphql/export.rs 0.00% 59 Missing ⚠️
src/ingest.rs 57.14% 3 Missing ⚠️
src/graphql/netflow.rs 0.00% 2 Missing ⚠️
src/graphql/network.rs 98.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #918      +/-   ##
==========================================
+ Coverage   77.17%   77.27%   +0.09%     
==========================================
  Files          32       32              
  Lines       25723    25651      -72     
==========================================
- Hits        19851    19821      -30     
+ Misses       5872     5830      -42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sophie-cluml sophie-cluml requested a review from sehkone December 3, 2024 08:30
timestamp: DateTime<Utc>,
/// Source IP, or source IP address in long format.
Copy link
Contributor

Choose a reason for hiding this comment

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

Source IP address only would suffice without Source IP

Copy link
Contributor

Choose a reason for hiding this comment

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

What does long format means?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is now modified to Source IP address.. Long format was what I got from consultation with ChatGPT. I don't think we need it anymore.

orig_addr: String,
/// Source port, or source port number in long format.
Copy link
Contributor

@sehkone sehkone Dec 4, 2024

Choose a reason for hiding this comment

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

Source port number would suffice without Source port

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@sophie-cluml sophie-cluml force-pushed the sophie/issue-917 branch 2 times, most recently from 1a5dd56 to d5f4dad Compare December 5, 2024 09:16
@sophie-cluml sophie-cluml marked this pull request as ready for review December 5, 2024 09:20
@sophie-cluml sophie-cluml changed the title [Draft] Add document for GraphQL API connRawEvents Add document for GraphQL API connRawEvents Dec 5, 2024
@@ -3217,7 +3217,7 @@ async fn union() {
}
}"#;
let res = schema.execute(query).await;
assert_eq!(res.data.to_string(), "{networkRawEvents: {edges: [{node: {timestamp: \"2019-12-31T23:59:59+00:00\", __typename: \"BootpRawEvent\"}}, {node: {timestamp: \"2020-01-01T00:00:01+00:00\", __typename: \"SshRawEvent\"}}, {node: {timestamp: \"2020-01-01T00:00:05+00:00\", __typename: \"SmtpRawEvent\"}}, {node: {timestamp: \"2020-01-01T00:01:01+00:00\", __typename: \"ConnRawEvent\"}}, {node: {timestamp: \"2020-01-05T00:01:01+00:00\", __typename: \"RdpRawEvent\"}}, {node: {timestamp: \"2020-01-05T06:05:00+00:00\", __typename: \"DceRpcRawEvent\"}}, {node: {timestamp: \"2020-06-01T00:01:01+00:00\", __typename: \"HttpRawEvent\"}}, {node: {timestamp: \"2021-01-01T00:01:01+00:00\", __typename: \"DnsRawEvent\"}}, {node: {timestamp: \"2022-01-05T00:01:01+00:00\", __typename: \"NtlmRawEvent\"}}, {node: {timestamp: \"2023-01-05T00:01:01+00:00\", __typename: \"KerberosRawEvent\"}}, {node: {timestamp: \"2023-01-05T12:12:00+00:00\", __typename: \"FtpRawEvent\"}}, {node: {timestamp: \"2023-01-05T12:12:00+00:00\", __typename: \"MqttRawEvent\"}}, {node: {timestamp: \"2023-01-06T11:11:00+00:00\", __typename: \"TlsRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:12:00+00:00\", __typename: \"LdapRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:12:10+00:00\", __typename: \"SmbRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:13:00+00:00\", __typename: \"NfsRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:13:10+00:00\", __typename: \"DhcpRawEvent\"}}]}}");
assert_eq!(res.data.to_string(), "{networkRawEvents: {edges: [{node: {timestamp: \"2019-12-31T23:59:59+00:00\", __typename: \"BootpRawEvent\"}}, {node: {timestamp: \"2020-01-01T00:00:01+00:00\", __typename: \"SshRawEvent\"}}, {node: {timestamp: \"2020-01-01T00:00:05+00:00\", __typename: \"SmtpRawEvent\"}}, {node: {time: \"2020-01-01T00:01:01+00:00\", __typename: \"ConnRawEvent\"}}, {node: {timestamp: \"2020-01-05T00:01:01+00:00\", __typename: \"RdpRawEvent\"}}, {node: {timestamp: \"2020-01-05T06:05:00+00:00\", __typename: \"DceRpcRawEvent\"}}, {node: {timestamp: \"2020-06-01T00:01:01+00:00\", __typename: \"HttpRawEvent\"}}, {node: {timestamp: \"2021-01-01T00:01:01+00:00\", __typename: \"DnsRawEvent\"}}, {node: {timestamp: \"2022-01-05T00:01:01+00:00\", __typename: \"NtlmRawEvent\"}}, {node: {timestamp: \"2023-01-05T00:01:01+00:00\", __typename: \"KerberosRawEvent\"}}, {node: {timestamp: \"2023-01-05T12:12:00+00:00\", __typename: \"FtpRawEvent\"}}, {node: {timestamp: \"2023-01-05T12:12:00+00:00\", __typename: \"MqttRawEvent\"}}, {node: {timestamp: \"2023-01-06T11:11:00+00:00\", __typename: \"TlsRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:12:00+00:00\", __typename: \"LdapRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:12:10+00:00\", __typename: \"SmbRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:13:00+00:00\", __typename: \"NfsRawEvent\"}}, {node: {timestamp: \"2023-01-06T12:13:10+00:00\", __typename: \"DhcpRawEvent\"}}]}}");
Copy link
Contributor

Choose a reason for hiding this comment

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

timestamp here does not need to change to time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

{node: {timestamp: \"2020-01-01T00:01:01+00:00\", __typename: \"ConnRawEvent\"}}

is changed to

{node: {time: \"2020-01-01T00:01:01+00:00\", __typename: \"ConnRawEvent\"}}

The change of timestamp to time occurs here partially only for ConnRawEvent, not for other events. It is because networkRawEvents is a GraphQL query that returns an Union type, and in this case ConnRawEvent is one of the types included in that Union type response. Since this PR targets to change ConnRawEvent, only above part of code is modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By the way, do you think it is better to modify timestamp to time in all event protocols all at once, in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Once we decided to changed timestamp to time, I think it would be better to complete it all at once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understood. I created an issue regarding timestamp-to-time as #922, and this PR has been updated to resolve that issue together at once.

@sophie-cluml sophie-cluml force-pushed the sophie/issue-917 branch 2 times, most recently from 678d34e to 1c796cc Compare December 10, 2024 06:55
@sophie-cluml sophie-cluml changed the title Add document for GraphQL API connRawEvents Replace timestamp with time & Add document for GraphQL API connRawEvents Dec 10, 2024
@sophie-cluml sophie-cluml requested a review from sehkone December 23, 2024 08:50
@sophie-cluml
Copy link
Contributor Author

@sehkone 시간 괜찮으시다면 리뷰 부탁드릴 수 있을까요? 최근 push 들은 단순 rebase들 입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants