-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Turn log file records into JSON. -- -- Take an httpd.conf style LogFormat string and parse log files into -- JSON records. @package log2json @version 0.1 -- | LogFormat is a Haskell module that makes it trivial to parse access -- log records. module Text.LogFormat -- | Parser a is a Parsec parser for Strings that parses an a. type Parser a = Parsec String () a -- | A LogFormat string is made up of literal strings (which must match -- exactly) and % directives that match a certain pattern and can have an -- optional modifier string. data Rule Literal :: String -> Rule Keyword :: Char -> (Maybe String) -> Rule logFormatParser :: String -> Either ParseError (Parser (Map String String)) logFormatSpecParser :: Stream s m Char => ParsecT s u m [Rule] combineLiterals :: [Rule] -> [Rule] rule :: Stream s m Char => ParsecT s u m Rule simpleRule :: Stream s m Char => ParsecT s u m Rule literalRule :: Stream s m Char => ParsecT s u m Rule sRule :: Stream s m Char => ParsecT s u m Rule iRule :: Stream s m Char => ParsecT s u m Rule literal :: Stream s m Char => ParsecT s u m Rule buildLogRecordParser :: [Rule] -> Parser (Map String String) headerParser :: Stream s m Char => Maybe [Char] -> ParsecT s u m (Map [Char] [Char]) -> ParsecT s u m (Map [Char] [Char]) -- | Take a parser and convert it to parse a Map instead of just a value. keyValueParser :: a -> Parser b -> Parser (Map a b) concatParser :: String -> Parser (String -> String -> String) -- | Parser for IP addresses ipParser :: Parser String -- | Parser for hostnames hostnameParser :: Parser String digits :: Stream s m Char => ParsecT s u m [Char] -- | Build a parser for a Rule. -- -- For Keyword Rules: -- -- Take a character that is used to define a field in the LogFormat -- specification and return a Parser that will parse out a -- key-value for that field from the input. For example, %U in a -- LogFormat means the URL path, so a URL path parser is available as -- --
--   parserFor (Keyword 'U' Nothing)
--   
parserFor :: Rule -> Parser (Map String String) instance Show Rule