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

Updated GC log parser to include status fields #4918

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions plaso/parsers/jsonl_plugins/gcp_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class GCPLogEventData(events.EventData):
resource_name (str): name of the resource.
service_account_display_name (str): display name of the service account.
service_name (str): name of the servie.
status_message (str): the status message of the request.
Copy link
Contributor

Choose a reason for hiding this comment

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

missed this in the first pass, lets keep these in alphabetical order too

status_reason (str): the reason behind the status message.
severity (str): log entry severity.
text_payload (str): text payload for logs not using a JSON or proto payload.
user (str): user principal performing the logged action.
Expand Down Expand Up @@ -68,6 +70,8 @@ def __init__(self):
self.service_account_display_name = None
self.service_name = None
self.severity = None
self.status_message = None
self.status_reason = None
self.text_payload = None
self.user = None

Expand Down Expand Up @@ -129,6 +133,17 @@ def _ParseProtoPayload(self, json_dict, event_data):
if method_name and not event_data.event_subtype:
event_data.event_subtype = method_name

status = self._GetJSONValue(proto_payload, 'status')
if status:
event_data.status_message = self._GetJSONValue(status, 'message')
status_details = self._GetJSONValue(status, 'details')
if status_details:
temp_reason = []
for status_detail in status_details:
temp_reason.append(self._GetJSONValue(status_detail, 'reason'))
if temp_reason:
event_data.status_reason = ';'.join(temp_reason)

self._ParseProtoPayloadRequest(proto_payload, event_data)
self._ParseProtoPayloadServiceData(proto_payload, event_data)

Expand Down
Loading