Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

How to get the list of queries executed in Hive

New Contributor



I'm looking to get the list of queries executed in the hive for the last 15 - 20 days can some one help me out on this.




Master Guru

@Sambasivam  Hive saves the last 100,00 lines into a file $HOME/.hivehistory. This may be a solution for this. 

Also you can do some hack like running a grep on 

cat ~/hive.log | grep "Starting command"
cat ~/hive.log | grep "Executing command"

Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Expert Contributor



Another way of collecting the data is from yarn ATS through Rest API calls.Please have a look and frame your rest api calls to access the data.

Expert Contributor

1. use Ranger Auditing for Hive to check the Query details run by a user. Hive does not store this detail in metastore.

2. You can use the below Query To get all the apps having states as FINISHED,KILLED by the specific user for specific time period

GET "http://Resource-Manager-Address:8088/ws/v1/cluster/apps?limit=20&states=FINISHED,KILLED&user=<user-id>&startedTimeBegin={time in epoch}&startedTimeEnd={time in epoch}"


3. Simply make use of Tez view if your execution Engine is Tez