You need to do the following steps to test this:
Create a python file in your preferred directory named as office_365.py and add the content as shared in the attachment.
Make this file executable with the following command:
Run the script manually with debug mode enabled:
Please replace <your_tenant_id>, <your_client_id> and <your_client_secret> with you relevant IDs and secret. Please share the command output so that we can review the debug log and identify the issue there.
I will wait for your response here.
[ERROR] Error while retrieving Office 365 activity logs: (' Request ', 'GET', ' ', 'https://manage.office.com/api/v1.0/........', ' failed with ', 400, ' - ', '{"error":{"code":"AF20023","message":"The subscription was disabled."}}' ).
This error refers to the issue that the unified audit logging for your Office 365 organization is not enable. You need to enable this by turning on the Office 365 audit log so that it can be used with Management Activity API. Reference: https://learn.microsoft.com/en-us/office/office-365-management-api/troubleshooting-the-office-365-management-activity-api#enable-unified-audit-logging-in-office-365
This troubleshooting document also refers to an error similar to the one you get with the default <office365> module.
Here is the guide from Microsoft to turn on Audit logging: https://learn.microsoft.com/en-us/purview/audit-log-enable-disable. Therefore, please complete the configuration properly in Microsoft end to enable the audit logging and then test the the office365 integration again.
I hope it helps. Please let us know how it goes.