Merge pull request #81 from simonpasquier/support-v2-notifications
Support Oslo messaging v2 notifications
diff --git a/heka/files/lua/decoders/notification.lua b/heka/files/lua/decoders/notification.lua
index d4073d9..5b1195d 100644
--- a/heka/files/lua/decoders/notification.lua
+++ b/heka/files/lua/decoders/notification.lua
@@ -112,7 +112,16 @@
local data = read_message("Payload")
local ok, notif = pcall(cjson.decode, data)
if not ok then
- return -1
+ return -1, string.format("Failed to parse notification: %s: '%s'", notif, string.sub(data or 'N/A', 1, 64))
+ end
+
+ local oslo_version = notif['oslo.version']
+ if oslo_version then
+ -- messagingv2 notifications
+ ok, notif = pcall(cjson.decode, notif['oslo.message'])
+ if not ok then
+ return -1, string.format("Failed to parse v%s notification: %s: '%s'", oslo_version, notif, string.sub(data or 'N/A', 1, 64))
+ end
end
if include_full_notification then