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

add log-events.py script #368

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

jzding
Copy link
Member

@jzding jzding commented Oct 31, 2024

Usaeg:
oc -n cloud-events logs -f deployment/cloud-consumer-deployment -c cloud-event-consumer | python3 hack/log-events.py

Results:

PULL: events pulled by calling GET api/ocloudnotifications/v2/{resource_address}/CurrentState
⬅️ 2024-10-31T14:23:01.6652Z: event.sync.sync-status.os-clock-sync-state-change
⬅️ 2024-10-31T14:24:01.6618Z: event.sync.ptp-status.ptp-state-change

PUSH: events pushed by PTP producer
➡️ 2024-10-31T14:45:15.0756Z: event.sync.ptp-status.ptp-state-change
➡️ 2024-10-31T14:45:15.0757Z: event.sync.sync-status.synchronization-state-change

log_message = log_message.replace('\\"', '"')

# Extract JSON part from the log message
json_part = re.search(r'{.*}', log_message).group()
Copy link
Member

Choose a reason for hiding this comment

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

you should check if this return result

Copy link
Member

Choose a reason for hiding this comment

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

json_match = re.search(r'{.*}', log_message)
if not json_match:
print("No JSON part found in log message.")
return

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

Copy link
Member

@aneeshkp aneeshkp left a comment

Choose a reason for hiding this comment

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

please see comments

@openshift-ci openshift-ci bot removed the lgtm label Oct 31, 2024
Signed-off-by: Jack Ding <jackding@gmail.com>
Copy link
Member

@aneeshkp aneeshkp left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 4, 2024
Copy link
Contributor

openshift-ci bot commented Nov 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aneeshkp, jzding

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 8c4d35f into redhat-cne:main Nov 4, 2024
5 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cloud-event-proxy
This PR has been included in build cloud-event-proxy-container-v4.18.0-202411041509.p0.g8c4d35f.assembly.stream.el9.
All builds following this will include this PR.

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

Successfully merging this pull request may close these issues.

3 participants