Created
February 26, 2020 23:35
-
-
Save prashanthmadi/a84d69e41dc170b241daba7e21d9858e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script adds the logrotate policy for .out files to ensure the logs are compressed, rotated and eventually removed from the VM | |
sudo echo "HealingService action to configure logrotate policy initiated." | logger | |
path="/etc/logrotate.d" | |
sudo mkdir -p $path | |
cat > /tmp/logrotate-policy <<EOF | |
/var/log/ambari-agent/ambari-agent.out | |
/var/log/ambari-metrics-collector/*.out | |
/var/log/ambari-metrics-grafana/grafana.out | |
/var/log/ambari-metrics-monitor/ambari-metrics-monitor.out | |
/var/log/ambari-server/ambari-server.out | |
/var/log/hdinsight-startupagent/hdinsight-startupagent.out | |
/var/log/oozie/catalina.out | |
/var/log/failover-controller/*.out | |
/var/log/hbase/*.out | |
/var/log/hdinsight-agent/hdinsight-agent.out | |
/var/log/hive/hive-server2.out | |
/var/log/hive/hive.out | |
/var/log/hdinsight-probes/hdinsight-probes.out | |
/var/log/hdinsight-provisioning-agent/hdinsight-provisioning-agent.out | |
/var/log/hdinsight-smart-probes/hivellap/hivellap-smart-probes.out | |
/var/log/ranger/admin/catalina.out | |
/var/log/hdinsight-credentialservice/credentialservice.out | |
/var/log/hdinsight-patchingagent/hdinsight-patchingagent.out | |
/var/log/hdinsight-mds-starter/hdinsight-mds-starter.out | |
/var/log/hdinsight-startupagent/hdinsight-startupagent.out | |
/var/log/hdinsight-zookeeper/zookeeper.out | |
/var/log/hadoop/hdfs/*.out | |
/var/log/hadoop-mapreduce/mapred/*.out | |
/var/log/hadoop-yarn/yarn/*.out | |
/var/log/hadoop-yarn/embedded-yarn-ats-hbase/*.out | |
/var/log/livy2/livy-livy-server.out | |
/var/log/spark2/*.out | |
/var/log/storm/*.out | |
/var/log/zeppelin/*.out | |
/var/log/zookeeper/*.out | |
{ | |
missingok | |
compress | |
dateext | |
maxsize 100M | |
copytruncate | |
maxage 90 | |
dateformat -%Y%m%d%s | |
rotate 7 | |
notifempty | |
} | |
EOF | |
sudo mv /tmp/logrotate-policy /etc/logrotate.d/logrotate-policy | |
sudo echo "HealingService action to configure logrotate policy completed." | logger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment