splunk / eventgen

Splunk Event Generator: Eventgen
Apache License 2.0
376 stars 180 forks source link

[BUG] Issue with S2S output mode and lines over 120 char #392

Open ghost opened 4 years ago

ghost commented 4 years ago

Describe the bug Exception in thread OutputThread0: Traceback (most recent call last): File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/local/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/eventgen_core.py", line 318, in _worker_do_work raise e File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/eventgen_core.py", line 304, in _worker_do_work item.run() File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/lib/outputplugin.py", line 39, in run self.flush(self.events) File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/lib/plugins/output/s2s.py", line 204, in flush m["_time"], File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/lib/plugins/output/s2s.py", line 173, in send_event e = self._encode_event(index, host, source, sourcetype, _raw, _time) File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/lib/plugins/output/s2s.py", line 124, in _encode_event encoded_raw = self._encode_key_value("_raw", _raw) File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/lib/plugins/output/s2s.py", line 78, in _encode_key_value return "%s%s" % (self._encode_string(key), self._encode_string(value)) File "/usr/local/lib/python3.7/site-packages/splunk_eventgen/lib/plugins/output/s2s.py", line 69, in _encode_string "utf-8" UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 3: invalid continuation byte

To Reproduce Steps to reproduce the behavior: use outputmode=s2s

Expected behavior no exception

Actual behavior exception above

Do you run eventgen with SA-eventgen? No

If you are using SA-Eventgen with Splunk (please complete the following information): linux python 3.7 eventgen version git master

aparajith21 commented 1 year ago

Issue can be solved by replacing utf-8 with ISO-8859-1 or charmap, both of which have a 1 to 1 mapping between bytes and characters in /splunk_eventgen/lib/plugins/output/s2s.py. Can fix please assign