Support Questions

Find answers, ask questions, and share your expertise

how to limit collector-gc.log creation under /var/log/ambari-metrics-collector

avatar

Under ambari-metrics-collector we have many files as ollector-gc.log

how to limit the number of this files to 5 max ?

as I know we can set the follwing syntax in ambari configuration ( I guess ams-env )

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=4K

but I am not sure on which variable in ams-env we can set it ?

/var/log/ambari-metrics-collector
4.0K    collector-gc.log-201804251456
4.0K    collector-gc.log-201804251517
4.0K    collector-gc.log-201805011453
4.0K    collector-gc.log-201805031000
4.0K    collector-gc.log-201805061332
4.0K    collector-gc.log-201805071101
4.0K    collector-gc.log-201805211039
4.0K    collector-gc.log-201806031253
4.0K    collector-gc.log-201806041646
4.0K    collector-gc.log-201806131159
4.0K    collector-gc.log-201806131204
4.0K    collector-gc.log-201806131219
4.0K    collector-gc.log-201806240625
4.0K    collector-gc.log-201806241235
4.0K    collector-gc.log-201806241409
4.0K    collector-gc.log-201806280803
4.0K    collector-gc.log-201807160859
4.0K    collector-gc.log-201807160908
4.0K    collector-gc.log-201807160913
4.0K    collector-gc.log-201807160930
4.0K    collector-gc.log-201807160934
4.0K    collector-gc.log-201807160937
4.0K    collector-gc.log-201807161112
4.0K    collector-gc.log-201807161114
4.0K    collector-gc.log-201807161118
4.0K    collector-gc.log-201807161130
4.0K    collector-gc.log-201807161132
4.0K    collector-gc.log-201807161137
4.0K    collector-gc.log-201807161147
4.0K    collector-gc.log-201807161152
4.0K    collector-gc.log-201807161201
Michael-Bronson
1 ACCEPTED SOLUTION

avatar

Hi @Michael Bronson ,

Adding the below parameters for AMS_COLLECTOR_GC_OPTS in ams-env template and SERVER_GC_OPTS in ams-hbase-env template via ambari

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=4K

Helped me.

I hope this is your query.

you might need to add it in this two places to control collector-gc.log and gc.log

Hope this helps.

if you find this answer usefull please mark the 'accept' button so that it helps other community users to find the best one.

View solution in original post

3 REPLIES 3

avatar

Hi @Michael Bronson ,

Adding the below parameters for AMS_COLLECTOR_GC_OPTS in ams-env template and SERVER_GC_OPTS in ams-hbase-env template via ambari

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=4K

Helped me.

I hope this is your query.

you might need to add it in this two places to control collector-gc.log and gc.log

Hope this helps.

if you find this answer usefull please mark the 'accept' button so that it helps other community users to find the best one.

avatar

can I add the syntax on the end of the line - so the final line should be like this ?

export AMS_COLLECTOR_GC_OPTS="-XX:+UseConcMarkSweepGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'` -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=4K"
Michael-Bronson

avatar

Hi @Michael Bronson ,

Yeah exactly thats what i did.