Azure Linux VM's OmsAgent eating up local disk space

Atanu Gupta 141 Reputation points
2022-11-01T09:22:12.897+00:00

Hello,

I have enabled diagnostic setting for my Linux VM to send log data to storage account

255908-digonosticsettings.png

The extension also got added as expected.

255920-extensions.png

Now the problem is that the omsagent has started generating lot of local files in the VM disk which eventually eating up the disk space as follows

total 1.3G
-rwxr-xr-x. 1 omsagent omiusers 1.3G Oct 18 09:16 omsconfigdetailed.log
-rwxr-xr-x. 1 omsagent omiusers 42M Oct 18 09:16 omsconfig.log

Now is there any way to stop this local file generation? Please advise

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,782 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,075 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. kobulloc-MSFT 23,181 Reputation points Microsoft Employee
    2022-11-01T22:47:35.613+00:00

    Hello, @Atanu Gupta !

    How do I prevent the OmsAgent logs from taking up local disk space on my VM?
    You may notice that omsconfigdetailed.log and omsconfig.log are taking up space on your VM. While there is currently no way to disable these logs, you are able to change the size of the logs using the logratate settings.

    Additionally, you can consider using the new Azure Monitor Agent (AMA), which doesn't run into this issue. The legacy Log Analytics agent (OMS) will be deprecated by August 2024.

    This GitHub issue goes into more detail on logratate:
    https://github.com/microsoft/omi/issues/531#issuecomment-398624551

    omsconfig's logrotate setting like below:
    https://github.com/Microsoft/PowerShell-DSC-for-Linux/blob/master/Providers/Extras/Scripts/omsconfig_logrotate.conf

    jumping@jumping-ub14:/root$ cat /etc/logrotate.d/omsconfig
    /var/opt/microsoft/omsconfig/omsconfig.log {
    rotate 5
    sharedscripts
    weekly
    size 50M
    compress
    }

    /var/opt/microsoft/omsconfig/omsconfigdetailed.log {
    rotate 5
    sharedscripts
    size 50M
    compress
    }
    jumping@jumping-ub14:/root$

    Additional reference:

    2 people found this answer helpful.

  2. PRANOY BEJ 1 Reputation point
    2022-11-03T14:53:30.48+00:00

    The reason behind this is the extensive amount of logs that OMS agent generates. While it is not possible to disbale those oms logs files but you can limit the log file size using the logrorate(/etc/logrotate.d).
    The below is the logrorate settings I use to control the file size:

    cat /etc/logrotate.d/omsconfig
    /var/opt/microsoft/omsconfig/omsconfig.log {
    rotate 7
    sharedscripts
    weekly
    size 100M
    compress
    }
    /var/opt/microsoft/omsconfig/omsconfigdetailed.log {
    rotate 7
    sharedscripts
    size 100M
    compress
    }

    0 comments No comments