How can I control the log size for Windows-based Monitoring and App Agents?

How can I control the log size for Windows-based Monitoring and App Agents?

We have a windows server with the DotNetAgent installed. The agent's log folder was using 21GB of storage space. How can I control the amount of space that both the Monitoring Agent and the Application Agent can consume on a server?