Automatically purging OMS log and trace files in EM12c

Enterprise Manager Oracle Management Server (OMS) installations generate huge amounts of log and trace files under the covers these days, and although the logs are rotated out-of-the-box, they’re not automatically deleted.  Over time (as I was reminded again today :roll: ), these logs can amount to a large portion of your disk space being used.

MOS note 1450535.1 explains that Enterprise Manager Cloud Control 12c now can be configured to automatically delete the GCDomain.log, EMGC_ADMINSERVER.log, and access.log files, but it still doesn’t account for everything.  The location of these log/trace files can be found as follows in an EM12c installation:

MW_HOME=/u01/app/oracle/middleware
OMS_HOME=$MW_HOME/oms12c
EM_INST_HOME=$OMS_HOME/gc_inst
AGENT_HOME=$MW_HOME/agent12c

OPMN:

$EM_INST_HOME/WebTierIH*/diagnostics/logs/OPMN/opmn

Oracle HTTP Server (OHS):

$EM_INST_HOME/WebTierIH*/diagnostics/logs/OHS/ohs*

WebLogic Admin Server (primary OMS only):

$EM_INST_HOME/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/logs

WebLogic OMS (Managed Server):

$EM_INST_HOME/user_projects/domains/GCDomain/servers/EMGC_OMS*/logs

WebLogic EM Node Manager:

$EM_INST_HOME/NodeManager/emnodemanager/nodemanager.log

OMS SYSMAN:

${EM_INST_HOME}/em/EMGC_OMS*/sysman/log

Management Agent:

$AGENT_HOME/agent_inst/sysman/log

Automatic purge scripts

…so to take care of this, I decided to put a script together which removes old log and trace files (over 15 days by default) from these locations:

purge_em12c_logs.sh

…once tested, I scheduled this to run every Sunday at midnight via cron, on each OMS machine:

0 0 * * 0 /home/oracle/scripts/purge_em12c_logs.sh > /home/oracle/scripts/purge_em12c_logs.out

If anyone out there is still using Enterprise Manager 11g (or even 10g!) Grid Control, then I have a couple of scripts for those too, although the later could probably be refined:

purge_em11g_logs.sh
purge_em10g_logs.sh (requires restart of the OMS)

 

References:
12c Cloud Control: How to Enable Log Rotation Policy to Automatically Delete Older GCDomain.log, EMGC_ADMINSERVER.log and access.log Files? [ID 1450535.1]
EM 12c Cloud Control: Steps to Locate and Manage the Various Logs/Trace files in a 12c OMS Installation [ID 1448308.1]
12c Cloud Control: Which WLS Log Files Can be Removed / Purged Manually at Regular Intervals in 12c OMS Installation for Space Considerations? [ID 1445743.1]

Leave a comment

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>