imperva / incapsula-logs-downloader

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

FR: logfilename #61

Closed AVitg closed 1 year ago

AVitg commented 1 year ago

Hi @joeymoore, I had made an adjustment in the old/master (pre beta 3) version of the LogDownloader, that helped me to have the source/log file name of each message (xyz_zyxx.log) in the CEF event. i solved the need for myself here add logfilename, however this solutions also touches the send() mehtod of the original SyslogClient library, just to align the call of the function and the HandlingLogs.py as well.

For me this does not feel like it fits to the nice code you have provided so far. hence I did not do a PR. @joeymoore do you see any issues with my code, or can you think of a solution thats better/ nicer?

KR Andreas

joeymoore commented 1 year ago

Hello @AVitg , I see what you're trying to do and as I review the change, I would only recommend providing a default value for the optional "logfilename" in the other classes. So for your custom syslog sender and the others, use: def message_customize(self,msg, logfilename=None) or def send(self, data, logfilename=None) The other senders will not care about this nor need to handle it but you're custom logic might need to account for a "None" value. Doesn't have to be None, could be "no.log-{datetime}.