Tail File Input (new line delimited)
todo: when more than line splitting is needed the file should be read in chunks and passed to a generic splitter buffer with a token/match specification and a find function similar to the Heka stream reader.
warning: if the file being tailed is not flushed on newline Lua reads and
returns the partial line before the
1. Sample Configuration
filename = "tail.lua" ticker_interval = 1 -- poll once a second after hitting EOF -- Name of the input file input_filename = "/var/log/text.log" -- Multi-line log support -- delimiter = "^# User@Host:" -- optional if anchored at the beginning of the line it is treated as -- a start of record delimiter and the line belongs to the next log -- otherwise it is an end of record delimiter and the line belongs to -- the current log. "^$" is special cased and is treated as an end of -- line delimiter. -- Consumes appended data as the file grows -- Default: -- follow = "descriptor" -- use "name" for rotated logs -- Heka message table containing the default header values to use, if they are -- not populated by the decoder. If 'Fields' is specified it should be in the -- hashed based format see: http://mozilla-services.github.io/lua_sandbox/heka/message.html -- Default: -- default_headers = nil -- printf_messages = -- see: https://mozilla-services.github.io/lua_sandbox_extensions/lpeg/modules/lpeg/printf.html -- Specifies a module that will decode the raw data and inject the resulting message. -- Supports the same syntax as an individual sub decoder -- see: https://mozilla-services.github.io/lua_sandbox_extensions/lpeg/io_modules/lpeg/sub_decoder_util.html -- Default: -- decoder_module = "decoders.payload" -- Boolean, if true, any decode failure will inject a message of Type "error", -- with the Payload containing the error. -- Default: -- send_decode_failures = false
source code: tail.lua