Here is a solution to anyone that might be having issues with their log files either filling up their drives, or AX crashing with an error of a log file being full.
Firstly, determine what the log file name is, using the following script
(Substitute <Database Name> with your AX installation’s database name):
SELECT name FROM <Database Name>.sys.database_files WHERE type_desc=’LOG’
Secondly, you will have to decide on the minimum size your log file should be, we use 256MB but it can be anything from 0MB. SQL will automatically change the value if your log file is too small for the number of pages needed.
The resulting name from the query will be used in the next query for the <Database Log Name>:
Now, run the following:
USE <Database Name>
ALTER DATABASE <Database Name> SET RECOVERY SIMPLE
DBCC SHRINKFILE (N’<Database Log Name>‘ , 256)
ALTER DATABASE <Database Name> SET RECOVERY FULL
On a daily or weekly basis, depending on your AX usage, you might want to implement a maintenance plan to shrink your log files. You would need to either run this as a sysadmin on the server or db owner on the database.