Interface SyslogParser


public interface SyslogParser
SyslogParser defines an interface for classes that parse Syslog into Map.
  • Method Summary

    Modifier and Type
    Method
    Description
    Parse a String to a Map.
    void
    parseLine(String line, java.util.function.Consumer<Map<String,Object>> consumer)
    Parse a String to a Map and provides that Map to the provided Consumer.
    Reads each line from the Reader and parses it to a List of Map.
    void
    parseLines(Reader reader, java.util.function.Consumer<Map<String,Object>> consumer)
    Reads each line from the Reader and parses it to Map, which is passed to the provided Consumer.
    void
    parseLines(Reader reader, java.util.function.Consumer<Map<String,Object>> messageConsumer, java.util.function.BiConsumer<String,Throwable> errorConsumer)
    Reads each line from the Reader and parses it to Map, which is passed to the provided Consumer.
  • Method Details

    • parseLine

      Map<String,Object> parseLine(String line)
      Parse a String to a Map.
      Parameters:
      line - the line of Syslog to parse
      Returns:
      a Map
      Throws:
      ParseException - if there is an error parsing
    • parseLine

      void parseLine(String line, java.util.function.Consumer<Map<String,Object>> consumer)
      Parse a String to a Map and provides that Map to the provided Consumer.
      Parameters:
      line - the line of Syslog to parser
      consumer - the Consumer
      Throws:
      ParseException - if there is an error parsing
    • parseLines

      List<Map<String,Object>> parseLines(Reader reader)
      Reads each line from the Reader and parses it to a List of Map.
      Parameters:
      reader - Reader used. It is not closed in this method.
      Returns:
      List of Map
      Throws:
      ParseException - if there is an error parsing
      IllegalArgumentException - if reader is null
    • parseLines

      void parseLines(Reader reader, java.util.function.Consumer<Map<String,Object>> consumer)
      Reads each line from the Reader and parses it to Map, which is passed to the provided Consumer.
      Parameters:
      reader - Reader used. It is not closed in this method.
      consumer - the Consumer
      Throws:
      ParseException - if there is an error parsing any line
      IllegalArgumentException - if reader or consumer are null
    • parseLines

      void parseLines(Reader reader, java.util.function.Consumer<Map<String,Object>> messageConsumer, java.util.function.BiConsumer<String,Throwable> errorConsumer)
      Reads each line from the Reader and parses it to Map, which is passed to the provided Consumer. For any line where a ParseException would be thrown, it will will be passed to the errorConsumer.
      Parameters:
      reader - Reader used. It is not closed in this method.
      messageConsumer - the Consumer for messages
      errorConsumer - the Consumer for syslog lines and their errors.
      Throws:
      IllegalArgumentException - if reader, messageConsumer, or errorConsumer are null