imperva / incapsula-logs-downloader

A Python script for downloading log files from Incapsula
MIT License
30 stars 35 forks source link

Log file not available with error on python script. #53

Closed basyir-nawi closed 1 year ago

basyir-nawi commented 1 year ago

I run the script for more than 20 minutes but all the request produce error failed to download index file. I think this is bug in the script due to the file in the Imperva Incapsula dashboard show there is log within 20 minutes during the script is running.

Here is the error produce by script: ---ERROR--- 2022-10-07 18:33:10,084 INFO Sleeping for 30 seconds before trying to fetch logs again... 2022-10-07 18:33:40,100 INFO No last downloaded file is found - downloading index file and starting to download all the log files in it 2022-10-07 18:33:40,113 INFO Downloading logs index file... 2022-10-07 18:33:41,189 WARNING Could not find file https://logs1.incapsula.com/XXXX_XXXXXXX/logs.index. Response code is 404 2022-10-07 18:33:41,208 ERROR Failed to downloading index file and starting to download all the log files in it - Index file does not yet exist, please allow time for files to be generated., Traceback (most recent call last): File "./LogsDownloader_master.py", line 129, in get_log_files self.logs_file_index.download() File "./LogsDownloader_master.py", line 497, in download raise Exception('Index file does not yet exist, please allow time for files to be generated.') Exception: Index file does not yet exist, please allow time for files to be generated.

2022-10-07 18:33:41,212 INFO Sleeping for 30 seconds before trying to fetch logs again... ---ERROR---

joshberkley6221 commented 1 year ago

everything works fine but after about 2 hours this happens:

Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: Traceback (most recent call last): Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: File "/etc/incapsula/incapsula-logs-downloader-master/script/LogsDownloader.py", line 146, in get_log_files Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: success = self.handle_file(next_file) Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: File "/etc/incapsula/incapsula-logs-downloader-master/script/LogsDownloader.py", line 237, in handle_file Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: file.write(result[1]) Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: TypeError: write() argument must be str, not bytes Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: 2023-01-30 14:53:56,797 DEBUG The last known downloaded file is 5572_1447882.log Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: 2023-01-30 14:53:56,797 DEBUG Will now try to download 5572_1447883.log Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: 2023-01-30 14:53:56,814 WARNING Could not find file https://logs1.incapsula.com/5572_1302533/5572_1447883.log. Response code is > Jan 30 14:53:56 HTHPSECENGDKR01.hilltop.global bash[50964]: 2023-01-30 14:53:56,814 INFO Sleeping for 5 seconds until next file download retry number 1 out of 3

joeymoore commented 1 year ago

@joshberkley6221 @basyir-nawi please let me know if this is still an issue. A new 3.0.0 release is available and resolves a lot of known issues. Please review the readme if planning to upgrade. https://github.com/imperva/incapsula-logs-downloader/tree/release-3.0.0-beta

joshberkley6221 commented 1 year ago

Thanks. We are good . I will check out the new version and do some reading but for now we are good.

Josh Berkley Hilltop Holdings Inc. Distinguished Engineer direct 972.588.3414 | fax 877.420.0034 | mobile 940.208.6261 6221 Riverside Dr, Suite 105 | Irving, TX 75039

@.**@.> | Hilltop-Holdings.com CONFIDENTIALITY NOTICE: The information contained in this email communication (including any attachment(s)) is strictly confidential and intended solely for the person or entity named above. If you are not the intended recipient of this email, you are hereby notified that any disclosure, distribution, reproduction, or other use of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return email and permanently delete this communication (including any attachment(s)) from your system.

CONTRACT NOTICE: Nothing within this email communication, including the signature block, should be construed as forming a contract, binding an offer, establishing acceptance, or constituting a signed agreement. The author of this email communication is not authorized, and has no intent, to make offers or enter into contracts or agreements via email communications. From: Joe Moore @.> Sent: Wednesday, March 22, 2023 10:32 AM To: imperva/incapsula-logs-downloader @.> Cc: Josh Berkley @.>; Mention @.> Subject: Re: [imperva/incapsula-logs-downloader] Log file not available with error on python script. (Issue #53)

External Sender

@joshberkley6221https://urldefense.com/v3/__https:/github.com/joshberkley6221__;!!E2ahSuaTW0vh7g!t1_PUT8w1zW30MZT9F5bG_uW6mLOS2FNbvBNISwGnGtQnc2SCINEIh_UXIy4yZfOExFZs8bKowqTiNLE7QB5kZWcQCGvbH-M$ @basyir-nawihttps://urldefense.com/v3/__https:/github.com/basyir-nawi__;!!E2ahSuaTW0vh7g!t1_PUT8w1zW30MZT9F5bG_uW6mLOS2FNbvBNISwGnGtQnc2SCINEIh_UXIy4yZfOExFZs8bKowqTiNLE7QB5kZWcQATxDJBd$ please let me know if this is still an issue. A new 3.0.0 release is available and resolves a lot of known issues. Please review the readme if planning to upgrade. https://github.com/imperva/incapsula-logs-downloader/tree/release-3.0.0-betahttps://urldefense.com/v3/__https:/github.com/imperva/incapsula-logs-downloader/tree/release-3.0.0-beta__;!!E2ahSuaTW0vh7g!t1_PUT8w1zW30MZT9F5bG_uW6mLOS2FNbvBNISwGnGtQnc2SCINEIh_UXIy4yZfOExFZs8bKowqTiNLE7QB5kZWcQChnaVH_$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/imperva/incapsula-logs-downloader/issues/53*issuecomment-1479785234__;Iw!!E2ahSuaTW0vh7g!t1_PUT8w1zW30MZT9F5bG_uW6mLOS2FNbvBNISwGnGtQnc2SCINEIh_UXIy4yZfOExFZs8bKowqTiNLE7QB5kZWcQNGPZNgN$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AKSZ44JL4IUDAM47W7ZXHZTW5MLNFANCNFSM6AAAAAAQ7F3GAE__;!!E2ahSuaTW0vh7g!t1_PUT8w1zW30MZT9F5bG_uW6mLOS2FNbvBNISwGnGtQnc2SCINEIh_UXIy4yZfOExFZs8bKowqTiNLE7QB5kZWcQLCnAZWj$. You are receiving this because you were mentioned.Message ID: @.**@.>>