Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to get the list of queries executed in Hive

How to get the list of queries executed in Hive

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

Re: How to get the list of queries executed in Hive

Expert Contributor

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

Re: How to get the list of queries executed in Hive

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

Highlighted

Re: How to get the list of queries executed in Hive

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

 

 

Don't have an account?
Coming from Hortonworks? Activate your account here