code: private void findHostname() {
      String startupInfo = Environment.runCommand(
          "grep --max-count=1 STARTUP_MSG:\\s*host " + file.getName()).toString();
      Pattern pattern = Pattern.compile("\\s+(\\w+/.+)\\s+");
      Matcher matcher = pattern.matcher(startupInfo);
      if (matcher.find(0)) {
        hostname = matcher.group(1).split("/")[0];
        ips = new String[1];
        ips[0] = matcher.group(1).split("/")[1];
      }
    }
docs: Attempt to determine the hostname of the node that created the
  log file. This information can be found in the STARTUP_MSG lines
  of the Hadoop log, which are emitted when the node starts.