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

ASCII issue #59

Open
paddychang opened this issue Jun 7, 2023 · 4 comments
Open

ASCII issue #59

paddychang opened this issue Jun 7, 2023 · 4 comments

Comments

@paddychang
Copy link

Hi there,

Please help with the error message below.
I run the downloader in Docker. Currently, it throws out error messages again and again and the file 12873_2574.log is getting bigger. The downloader won't move to the next log file 12873_2575 for example.

The version is 2.2.1.

2023-06-02 12:07:55,531 INFO Saving file 12873_2574.log locally to the 'fail' folder 'ascii' codec can't encode character '\xe9' in position 0: ordinal not in range(128) Traceback (most recent call last):
File "/usr/local/bin/imperva-connector.py", line 226, in handle_file
self.handle_log_decrypted_content(logfile, decrypted_file)
File "/usr/local/bin/imperva-connector.py", line 286, in handle_log_decrypted_content
local_file.writelines(decrypted_file)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 0: ordinal not in range(128)

2023-06-02 12:07:55,540 ERROR Failed to download file 12873_2574.log. Error is - write() argument must be str, not bytes , Traceback (most recent call last):
File "/usr/local/bin/imperva-connector.py", line 226, in handle_file
self.handle_log_decrypted_content(logfile, decrypted_file)
File "/usr/local/bin/imperva-connector.py", line 286, in handle_log_decrypted_content
local_file.writelines(decrypted_file)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 0: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/imperva-connector.py", line 146, in get_log_files
success = self.handle_file(next_file)
File "/usr/local/bin/imperva-connector.py", line 237, in handle_file
file.write(result[1])
TypeError: write() argument must be str, not bytes

@joeymoore
Copy link
Contributor

Are you compressing and/or encrypting the log from the Management Console? If so, is this configured properly in the script config file?
image

@paddychang
Copy link
Author

Hi Joe,

Thank you for your reply.
We disabled the compress logs and restart the downloader. However, the errors are still coming out.
Is there any way we can try to fix it?

Thanks.

@paddychang
Copy link
Author

We enable to compress logs again because of the following info from the Imperva website.
Note: If you are using the pull mode to download your logs using the API Connector (Python script), compressed files must be used. Uncompressed files will result in an error (-3).

There is a file LastKnownDownloadedFileId.txt to record the current log file.
Can I use it to skip the log to the next one?

@joeymoore
Copy link
Contributor

Hello @paddychang, is it possible to use the 3.0.0 release, you should be having these issue in general but the best option would be to use the latest. Cheers

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

No branches or pull requests

2 participants