title: How to run a query hive and get the applicationID via log
body: <p>I'm writing a shell script that executes a hive command, writing the log and output information to two separate files:</p>
  
  <pre><code>hive -S -f pdr_extrator.sql 2&gt; pdr_extrator_log.txt | sed 's / [\ t] / | / g' 1&gt; pdr_extrator_out.txt
  </code></pre>
  
  <p>The log file, at the end of the execution, is as follows:</p>
  
  <blockquote>
    <p>log4j: WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.
    log4j: WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar: file: /usr/hdp/2.2.6.0-2800/hadoop/lib/slf4j-log4j12-1.7.5.jar! /Org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar: file: /usr/hdp/2.2.6.0-2800/hive/lib/hive-jdbc-0.14.0.2.2.6.0-2800-standalone.jar! / Org / slf4j / impl / StaticLoggerBinder.class]
    SLF4J: See <a href="http://www.slf4j.org/codes.html#multiple_bindings" rel="nofollow noreferrer">http://www.slf4j.org/codes.html#multiple_bindings</a> for an explanation.
    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] </p>
  </blockquote>
  
  <p>When I run via the command line, it is possible to obtain the applicationID of my specific query, as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/QNVzG.png" rel="nofollow noreferrer">ApplicationID - Hive command line</a></p>
  
  <p>I wonder if there is any way to get the applicationID via log.</p>
  
  <p>Today I am using the command <code>yarn application -list -appTypes TEZ</code> and monitoring the process that appears near the start of my query, to later use the command <code>yarn application -status application_XXXXX</code> to monitor only my execution.</p>
  
  <p>The problem is that this method is flawed, since another process may enter the queue at a similar time, for example.</p>
  
  <p>Your help is appreciated.</p>