Support Questions

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

How to get the list of queries executed in Hive

avatar
New Contributor

Hi,

 

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.

 

Thanks!

3 REPLIES 3

avatar
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"

Cheers!
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.

avatar
Expert Contributor

@Sambasivam 

 

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.

 

https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.4/data-operating-system/content/rest_apis_for_qu...

 

https://hadoop.apache.org/docs/r3.1.0/hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html#Query_gene...

avatar
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.

https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.4/audit-ref/content/managing_auditing_in_ranger_...

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