private Map<String, String> readAndParseStructuredData() throws IOException {
    int c = read(true);

    if (c == '-') {
      return null;
    }

    ByteArrayOutputStream ret = new ByteArrayOutputStream(128);

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

    Map<String, String> structuredData = new HashMap<>();
    while (c == '[') {

      // Read SD-ID
      while ((c = read(true)) != ' ' && c != ']') {
        ret.write(c);
      }

      String sdId = new String(ret.toByteArray());
      structuredData.put("sdId", sdId);
      ret.reset();

      while (c == ' ') {
        // Read PARAM-NAME
        while ((c = read(true)) != '=') {
          ret.write(c);
        }

        String sdKey = new String(ret.toByteArray());
        ret.reset();

        expect('"');

        // Read PARAM-DATA
        while ((c = read(true)) != '"') {
          ret.write(c);

          if (c == '\\') {
            c = read(true);
            ret.write(c);
          }
        }

        String sdValue = new String(ret.toByteArray());
        ret.reset();
        structuredData.put(sdKey, StringEscapeUtils.unescapeHtml4(sdValue));

        c = read(true);
      }

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

      c = read(false);
    }

    if (c != -1) {
      unread(c);
    }

    return structuredData;
  }
Read RFC 5424 structured data and parse it into map.
ql/src/java/org/apache/hadoop/hive/ql/log/syslog/SyslogParser.java