Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar

Steps to enable Query logging in Ambari server with Postgres Database

1. If it is Postgres as DB then add following property in ambari.properties

server.jdbc.properties.loglevel=2

After restart you can see SQL query logging to Ambari-server.out file

2.If it is MySQL as DB then add/update following property in ambari.properties.

append below value in JDBC URL

?logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true
Ex:
server.jdbc.rca.url=jdbc:mysql://apappudb.hdp.com:3306/ambariupgrade?logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true
and
server.jdbc.url=jdbc:mysql://apappudb.hdp.com:3306/ambariupgrade?logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true

After re-start you will find the logs in ambari-server.log

1,642 Views
Comments

?logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true

?logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true
avatar
Expert Contributor

Just a caution note:-

When you are trying to set "server.jdbc.properties.loglevel=2", it adds additional database query logging and it should be enabled only when we troubleshoot performance issues.

Advise to remove this property once the troubleshooting is over. We have seen 2x to 3x Ambari performance degradation when it is enabled.

Version history
Last update:
‎02-24-2017 08:14 PM
Updated by:
Contributors