简体   繁体   English

Hive 查询日志 - 每个查询的聚合日志

[英]Hive query log - aggregated logs per query

Where does Hive store the query logs? Hive 在哪里存储查询日志? There is a property hive.querylog.location from theGetting Started page . 入门页面有一个属性 hive.querylog.location 。 This seems to suggest each hive node/client will store the logs in this location.这似乎表明每个 hive 节点/客户端都将在此位置存储日志。 Is there a location where all of these aggregated per query?是否有一个位置可以将所有这些聚合到每个查询中?

By default, Hive stores its logs in /tmp/ currentuser location.默认情况下,Hive 将其日志存储在/tmp/ currentuser位置。 When the Hive shell is invoked using the hive command at the Unix/Linux prompt, Hive displays the location of the log using the line Hive history file= location of the log before the Hive prompt is displayed.当在 Unix/Linux 提示符下使用hive命令调用 Hive shell 时,Hive 在显示 Hive 提示符之前使用行Hive history file= location of the log显示Hive history file= location of the log Example output is shown below:示例输出如下所示:

[root@localhost root]# hive
Logging initialized using configuration in jar:file:/usr/lib/hive/lib/hive-common-0.10.0-cdh4.4.0.jar!/hive-log4j.properties
Hive history file=/tmp/root/hive_job_log_46a27ee2-7ac1-43f5-a66b-20d6ea982421_849420221.txt
hive>

If a Hive query generates MapReduce jobs, those logs can be viewed through the JobTracker page which is accessible via the browser.如果 Hive 查询生成 MapReduce 作业,则可以通过可通过浏览器访问的 JobTracker 页面查看这些日志。

The path to the logs is:日志的路径是:
Mapper logs: Job Tracker Page -> Completed Jobs -> Jobid -> map -> task id -> Task Logs
Reducer logs: Job Tracker Page -> Completed Jobs -> Jobid -> reduce -> task id -> Task Logs

Execute the query with below command使用以下命令执行查询

hive --hiveconf hive.root.logger=DRFA --hiveconf hive.log.dir=./logs --hiveconf hive.log.level=DEBUG -e "<query>"

OR

hive --hiveconf hive.root.logger=DRFA --hiveconf hive.log.dir=./logs --hiveconf hive.log.level=DEBUG -f <hql-file>

It will create a log file in logs folder.它将在日志文件夹中创建一个日志文件。 Make sure that the logs folder exist in current directory.确保当前目录中存在日志文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM