Hi,
Could you please check the Wazuh manager's full log around the time of restart? This could give insights if they're any errors with the integration. Also ensure the client secret hasn't expired in Azure AD. You should also verify that the App Registration in Azure AD has the necessary permissions:
AuditLog.Read.All
ActivityFeed.Read
ActivityFeed.ReadDlp
ServiceHealth.Read
You can also replace you config with this below.
<ossec_config>
<office365>
<enabled>yes</enabled>
<interval>1m</interval>
<curl_max_size>1M</curl_max_size>
<only_future_events>yes</only_future_events>
<api_auth>
<tenant_id>xxxxxxxxxx</tenant_id>
<client_id>xxxxxxxxxxx</client_id>
<client_secret>xxxxxxxx</client_secret>
<api_type>commercial</api_type>
</api_auth>
<subscriptions>
<subscription>Audit.AzureActiveDirectory</subscription>
<subscription>Audit.General</subscription>
<subscription>Audit.Exchange</subscription>
<subscription>Audit.SharePoint</subscription>
<subscription>DLP.All</subscription>
</subscriptions>
</office365>
</ossec_config>
Also, you need enable API audit logging and it takes 24h to have effect.
Please look at this documentation below to further assist with that
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