Support Questions

Find answers, ask questions, and share your expertise

Log file location - Is there a way to change /var/log location to /var/log/hdp during the install ?

avatar
Master Mentor

Log file location - Is there a way to change /var/log location to /var/log/hdp during the install ?

1 ACCEPTED SOLUTION

avatar

The best time to change log directories is at installation where each of the different components will expose their log directory prefix. This is where you can choose an alternate log directory prefix for which all component-specific logs will be created under.log-dir-prefix.png

View solution in original post

6 REPLIES 6

avatar

There's no single point where this change can be made. The reason is many components in the HDP stack will have their own log locations all set to /var/log.

The good news is most of the components already create a subdir for their logs under /var/log.

You could try symlinking /var/log/<component> to /var/log/hdp/<component> post-install, but the downside is having to apply the change on every node and deviating from defaults.

avatar
Master Mentor
@Andrew Grande

Thank you! No symlinks allowed at corporate level.

avatar

The best time to change log directories is at installation where each of the different components will expose their log directory prefix. This is where you can choose an alternate log directory prefix for which all component-specific logs will be created under.log-dir-prefix.png

avatar

If you've missed a folder at install time, you can use the API to amend it post-install, First, you will need to stop the service. You can then use the configs.sh script to easily modify it.

configs.sh is located in /var/lib/ambari-server/resources/scripts on your ambari server

If you would like to change the zookeeper log dir.

./configs.sh set localhost <clustername> zookeeper-env zk_log_dir “/my/new/zookeeper/log/directory”

avatar

I used:

grep '/var/log' /var/lib/ambari-agent/cache/cluster_configuration/* 

to identify all locations that need to be changed then Ambari/configs.sh to make the adjustments.

avatar
Contributor

It's simple to change it with ambari UI. Otherwise use the ambari configs.sh script and restart all the services. It's smooth and easy.