public List<Object> readEvent() throws IOException {
    int priority;
    int c = read(false);
    List<Object> row = new ArrayList<>(EXPECTED_COLUMNS);
    // Return null on initial EOF.
    if (c == -1) {
      return null;
    }

    if (c == '<') {
      priority = readInt();
      if (priority == -1) {
        return unmatchedEvent(c);
      }
      expect('>');
    } else {
      return unmatchedEvent(c);
    }

    int version = 0;
    Calendar cal;

    if (Character.isDigit(peek())) {
      // Assume ISO date and time
      int y = readInt();

      c = read(true);

      if (c == ' ') {
        // Assume this is a RFC 5424 message.
        version = y;

        if (version > MAX_SUPPORTED_VERSION) {
          throw new IOException("Unsupported syslog version: " + version);
        }

        skipSpaces();
        y = readInt();
        expect('-');
      } else if (c != '-') {
        throw new IOException("Unexpected syslog character: " + (char) c);
      }

      int m = readInt();
      expect('-');
      int d = readInt();

      c = read(true);

      if (c != 'T' && c != ' ') {
        throw new IOException("Unexpected syslog character: " + (char) c);
      }

      int hh = readInt();
      expect(':');
      int mm = readInt();
      expect(':');
      int ss = readInt();
      double subss = 0;

      c = read(true);

      if (c == '.') {
        // Fractions of seconds
        subss = readFractions();
        c = read(true);
      }

      int tz = 0;

      if (c == 'Z') {
        // UTC
      } else if (c == '-') {
        tz = readInt();

        if (peek() == ':') {
          read(true);
          tz = -(tz * 60 + readInt());
        }
      } else if (c == '+') {
        tz = readInt();

        if (peek() == ':') {
          read(true);
          tz = tz * 60 + readInt();
        }
      }

      cal = new GregorianCalendar(UTC, Locale.getDefault());

      cal.set(y, m - 1, d, hh, mm, ss);
      cal.set(Calendar.MILLISECOND, (int) (subss * 1000));
      cal.add(Calendar.MINUTE, tz);
    } else {
      // Assume BSD date and time
      int m = readMonthAbbreviation();

      expect(' ');
      skipSpaces();

      int d = readInt();

      expect(' ');
      skipSpaces();

      int hh = readInt();

      expect(':');

      int mm = readInt();

      expect(':');

      int ss = readInt();

      cal = new GregorianCalendar(Locale.ROOT);

      cal.set(Calendar.MONTH, m);
      cal.set(Calendar.DAY_OF_MONTH, d);
      cal.set(Calendar.HOUR_OF_DAY, hh);
      cal.set(Calendar.MINUTE, mm);
      cal.set(Calendar.SECOND, ss);
    }

    expect(' ');
    skipSpaces();

    String hostname = readWordString();

    expect(' ');

    byte[] appName = null;
    byte[] procId = null;
    byte[] msgId = null;
    Map<String, String> structuredData = null;

    if (version >= 1) {
      appName = readWordOrNil(48);
      expect(' ');
      procId = readWordOrNil(12);
      expect(' ');
      msgId = readWordOrNil(32);
      expect(' ');
      structuredData = readAndParseStructuredData();
    } else if (version == 0 && parseTag) {
      // Try to find a colon terminated tag.
      appName = readTag();
      if (peek() == '[') {
        procId = readPid();
      }
      expect(':');
    }

    c = skipSpaces();

    byte[] msg = null;
    if (c != -1) {
      msg = readLine();
    }
    createEvent(version, priority, cal, hostname, appName, procId, msgId, structuredData, msg, row);
    return row;
  }
Read the next Syslog message from the stream.

@return a parsed map of object, or null on EOF.
@throws IOException if the underlying stream fails, or unexpected
bytes are seen.
ql/src/java/org/apache/hadoop/hive/ql/log/syslog/SyslogParser.java