Created
December 21, 2015 18:49
-
-
Save xrl/fb9a8534b01c0d2ba12c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local cjson = require('cjson') | |
local fields = { | |
Type = "cisco", | |
Timestamp = nil, | |
Payload = "to be filled in...", | |
Logger = "logstreamer" | |
} | |
function process_message() | |
local raw_payload = read_message("raw") | |
local ok,json = pcall(cjson.decode, raw_payload) | |
if not ok then | |
if raw_payload == nil then | |
return -1, "could not parse nil payload" | |
else | |
return -1, "could not parse " .. raw_payload | |
end | |
end | |
fields.Payload = raw_payload | |
fields.Type = "filelog." .. json["type"] | |
inject_message(fields) | |
return 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment