Skip to content

Commit

Permalink
add ability for escaping (non performant)
Browse files Browse the repository at this point in the history
  • Loading branch information
djkhl committed Feb 26, 2025
1 parent 89d1bcb commit 350fa37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions logprep/abc/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ def _add_arrival_time_information_to_event(self, event: dict):
def _write_full_event_to_target_field(self, event_dict: dict, raw_event: bytearray):
target = self._config.preprocessing.get("add_full_event_to_target_field")
if raw_event is None:
raw_event = json.dumps(event_dict)
complete_event = json.dumps(raw_event)
raw_event = self._encoder.encode(event_dict)
complete_event = json.dumps(raw_event.decode("utf-8"))
event_dict.clear()
add_fields_to(event_dict, fields={target: complete_event}, overwrite_target=True)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/connector/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def test_add_full_event_to_target_field(self):
test_event = {"any": "content"}
connector._get_event = mock.MagicMock(return_value=(test_event, None))
result = connector.get_next(0.01)
expected = {"event": {"original": '{"any":"content"}'}}
expected = {"event": {"original": '"{\\"any\\":\\"content\\"}"'}}
assert result == expected, f"{expected} is not the same as {result}"

def test_pipeline_preprocessing_does_not_add_timestamp_delta_if_configured_but_log_arrival_timestamp_not(
Expand Down

0 comments on commit 350fa37

Please sign in to comment.