...
Navigate to Iguana Logs
Configure the following Search Criteria:
Channel
Type=Message
Hide Deleted
Time Range (If know the queued message time range)
Choose on Export
Choose A CSV file
Click on Export button to generate CSV
Open CSV in Excel and Delete None “Message“ type logs (such as “Ignored Data Msg“)
Back Iguana Logs with the same Step 2 Search Criteria
Click on “Last Processed Message” link
Scroll up/down to find the “Last Processed Message“ message that has “PROCESSED“ tag and click on it
Click on “Show me a direct link to this entry“ to capture the message refid
Use refid to find the last processed message in CSV file
Find refid in CSV MessageId column and delete all the earlier processed messages include the “Last Processed Message“
The remaining messages in CSV are queued messages
Iguana Translator
Copy the Lua code below into your translator
Update the
CHANNEL_NAME
,QUEUED_COUNT
, andLOG_COUNT
Update Iguana Log API endpoint if you query logs from another Iguana
Run the Lua code
Retrieve Queued Messages from line 56
Lua Code
Code Block | ||
---|---|---|
| ||
-- The main function is the first function called from Iguana.
function main()
-- 1) Define Queued Channel Name and Message Count
local CHANNEL_NAME = '01-File to Socket'
local QUEUED_COUNT = 3
local LOG_COUNT = 20 --Adjust QUERY COUNT if not all queued messages have been queried
-- 2) Query Queued and Ignored Data Msg Messages
local LogResults = net.http.post{
url = 'http://localhost:6543/api_query',
auth = {username = 'admin',password = 'password'},
parameters = {
source= CHANNEL_NAME,
limit = LOG_COUNT,
type="messages",
deleted = 'false',
reverse = true
}, live=true
}
local logXML = xml.parse{data=LogResults}.export
-- 3) Filter and validate only Queued Messages
local filteredLogMsgs = {}
for i= 1, logXML:childCount("message") do
if logXML:child("message", i).type:nodeValue() == "Message" then
table.insert(filteredLogMsgs, logXML:child("message", i))
end
end
-- 4) Get last Processed Message
LogResults = net.http.post{
url = 'http://localhost:6543/log_browse_get_dequeue_position',
auth = {username = 'admin',password = 'password'},
body = "Source="..CHANNEL_NAME,
live=true
}
logXML = json.parse{data=LogResults}
local processedMsg = logXML[CHANNEL_NAME]
local msgId = processedMsg.Date:gsub("/", "").."-"..processedMsg.Position
trace(msgId)
-- 5) Filter out processed Message
local queuedMsgs = {}
for i=1, #filteredLogMsgs do
if filteredLogMsgs[i].message_id:nodeValue() == msgId then
break
else
table.insert(queuedMsgs,filteredLogMsgs[i].data)
end
end
-- 6) Validate queued messages
if #queuedMsgs ~= QUEUED_COUNT then
error("Not all queued messages have been queried, increase LOG_COUNT")
end
trace(queuedMsgs)
end |