@Test public void checkInputFormat() throws IOException, InterruptedException { Configuration conf = new Configuration(false); conf.set("fs.default.name", "file: conf.set("nl.basjes.parse.apachehttpdlogline.format", logformat); conf.set("nl.basjes.parse.apachehttpdlogline.fields", "TIME.EPOCH:request.receive.time.epoch," + "HTTP.USERAGENT:request.user-agent"); File testFile = new File("src/test/resources/access.log"); Path path = new Path(testFile.getAbsoluteFile().toURI()); FileSplit split = new FileSplit(path, 0, testFile.length(), null); InputFormat inputFormat = ReflectionUtils.newInstance(ApacheHttpdLogfileInputFormat.class, conf); TaskAttemptContext context = new TaskAttemptContextImpl(conf, new TaskAttemptID()); RecordReader reader = inputFormat.createRecordReader(split, context); reader.initialize(split, context); assertTrue(reader.nextKeyValue()); Object value = reader.getCurrentValue(); if (value instanceof ParsedRecord) { assertEquals("1483272081000", ((ParsedRecord) value).getString("TIME.EPOCH:request.receive.time.epoch")); assertEquals("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36", ((ParsedRecord) value).getString("HTTP.USERAGENT:request.user-agent")); } else { fail("Wrong return class type"); } }
public ApacheHttpdLogfileRecordReader createRecordReader() { try { return new ApacheHttpdLogfileRecordReader(getLogFormat(), getRequestedFields(), getTypeRemappings(), getAdditionalDissectors()); } catch (IOException e) { return null; } }
ApacheHttpdLogfileInputFormat extends
        FileInputFormat<LongWritable, ParsedRecord> { public ApacheHttpdLogfileRecordReader createRecordReader() { try { return new ApacheHttpdLogfileRecordReader(getLogFormat(), getRequestedFields(), getTypeRemappings(), getAdditionalDissectors()); } catch (IOException e) { return null; } } }
ApacheHttpdLogfileInputFormat extends
        FileInputFormat<LongWritable, ParsedRecord> { public ApacheHttpdLogfileRecordReader createRecordReader() { try { return new ApacheHttpdLogfileRecordReader(getLogFormat(), getRequestedFields(), getTypeRemappings(), getAdditionalDissectors()); } catch (IOException e) { return null; } } ApacheHttpdLogfileInputFormat();  ApacheHttpdLogfileInputFormat(
            String logformat,
            Collection<String> requestedFields,
            Map<String, Set<String>> typeRemappings,
            List<Dissector> additionalDissectors); }
ApacheHttpdLogfileInputFormat extends
        FileInputFormat<LongWritable, ParsedRecord> { public ApacheHttpdLogfileRecordReader createRecordReader() { try { return new ApacheHttpdLogfileRecordReader(getLogFormat(), getRequestedFields(), getTypeRemappings(), getAdditionalDissectors()); } catch (IOException e) { return null; } } ApacheHttpdLogfileInputFormat();  ApacheHttpdLogfileInputFormat(
            String logformat,
            Collection<String> requestedFields,
            Map<String, Set<String>> typeRemappings,
            List<Dissector> additionalDissectors); List<String> listPossibleFields(String logformat); static List<String> listPossibleFields(String logformat, Map<String, Set<String>> typeRemappings, List<Dissector> additionalDissectors); String getLogFormat(); Set<String> getRequestedFields(); Map<String, Set<String>> getTypeRemappings(); List<Dissector> getAdditionalDissectors(); ApacheHttpdLogfileRecordReader createRecordReader(); ApacheHttpdLogfileRecordReader getRecordReader(); @Override RecordReader<LongWritable, ParsedRecord> createRecordReader(
            final InputSplit split, final TaskAttemptContext context); void setTypeRemappings(Map<String, Set<String>> newTypeRemappings); }
ApacheHttpdLogfileInputFormat extends
        FileInputFormat<LongWritable, ParsedRecord> { public ApacheHttpdLogfileRecordReader createRecordReader() { try { return new ApacheHttpdLogfileRecordReader(getLogFormat(), getRequestedFields(), getTypeRemappings(), getAdditionalDissectors()); } catch (IOException e) { return null; } } ApacheHttpdLogfileInputFormat();  ApacheHttpdLogfileInputFormat(
            String logformat,
            Collection<String> requestedFields,
            Map<String, Set<String>> typeRemappings,
            List<Dissector> additionalDissectors); List<String> listPossibleFields(String logformat); static List<String> listPossibleFields(String logformat, Map<String, Set<String>> typeRemappings, List<Dissector> additionalDissectors); String getLogFormat(); Set<String> getRequestedFields(); Map<String, Set<String>> getTypeRemappings(); List<Dissector> getAdditionalDissectors(); ApacheHttpdLogfileRecordReader createRecordReader(); ApacheHttpdLogfileRecordReader getRecordReader(); @Override RecordReader<LongWritable, ParsedRecord> createRecordReader(
            final InputSplit split, final TaskAttemptContext context); void setTypeRemappings(Map<String, Set<String>> newTypeRemappings);  }