private HiveHookEventProtoPartialBuilder getPostHookEvent(HookContext hookContext, boolean success) {
      QueryPlan plan = hookContext.getQueryPlan();
      LOG.info("Received post-hook notification for: " + plan.getQueryId());

      Map<OtherInfoType, JSONObject> other = new HashMap<>();
      HiveHookEventProto.Builder builder = HiveHookEventProto.newBuilder();
      builder.setEventType(EventType.QUERY_COMPLETED.name());
      builder.setTimestamp(clock.getTime());
      builder.setHiveQueryId(plan.getQueryId());
      builder.setUser(getUser(hookContext));
      builder.setRequestUser(getRequestUser(hookContext));
      if (hookContext.getOperationId() != null) {
        builder.setOperationId(hookContext.getOperationId());
      }
      addMapEntry(builder, OtherInfoType.STATUS, Boolean.toString(success));
      addMapEntry(builder, OtherInfoType.ERROR_MESSAGE, hookContext.getErrorMessage());
      addMapEntry(builder, OtherInfoType.QUERY_TYPE, hookContext.getQueryState().getCommandType());
      JSONObject perfObj = new JSONObject();
      for (String key : hookContext.getPerfLogger().getEndTimes().keySet()) {
        perfObj.put(key, hookContext.getPerfLogger().getDuration(key));
      }
      other.put(OtherInfoType.PERF, perfObj);
      return new HiveHookEventProtoPartialBuilder(builder, null, other, plan.getQueryStr(), null);
    }
Log events from hive hook using protobuf serialized format, partitioned by date.
ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java