Safe Haskell | Safe-Inferred |
---|
LogFormat is a Haskell module that makes it trivial to parse access log records.
- type Parser a = Parsec String () a
- data 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])
- keyValueParser :: a -> Parser b -> Parser (Map a b)
- concatParser :: String -> Parser (String -> String -> String)
- ipParser :: Parser String
- hostnameParser :: Parser String
- digits :: Stream s m Char => ParsecT s u m [Char]
- parserFor :: Rule -> Parser (Map String String)
Documentation
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.
logFormatParser :: String -> Either ParseError (Parser (Map String String))Source
combineLiterals :: [Rule] -> [Rule]Source
headerParser :: Stream s m Char => Maybe [Char] -> ParsecT s u m (Map [Char] [Char]) -> ParsecT s u m (Map [Char] [Char])Source
keyValueParser :: a -> Parser b -> Parser (Map a b)Source
Take a parser and convert it to parse a Map instead of just a value.
hostnameParser :: Parser StringSource
Parser for hostnames
parserFor :: Rule -> Parser (Map String String)Source
Build a parser for a Rule
.
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)