Skip to content

Instantly share code, notes, and snippets.

@hourback
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hourback/56e93786df14a17b14da to your computer and use it in GitHub Desktop.
Save hourback/56e93786df14a17b14da to your computer and use it in GitHub Desktop.
Lua decoder for Heka, for reading in WebSphere SystemOut.log files with unrecognized time stamp format
[4/23/15 4:49:49:371 CDT] 00003a01 CoordinatorCo E HMGR0140E: An event indicating that the core group membership is inconsistent was received. Recovery failed. The exception is com.ibm.ws.hamanager.runtime.config.ServerIndexNodeException: serverindex for node janmsdlxwas04 does not contain server celig1_janmsdlxwas04_cnataraj
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses$ServerIndexParser.getServerIndexForServer(CoreGroupProcesses.java:376)
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses.<init>(CoreGroupProcesses.java:135)
at com.ibm.ws.hamanager.runtime.config.CoreGroupConfig.<init>(CoreGroupConfig.java:113)
at com.ibm.ws.hamanager.runtime.config.StateBlobBuilder.buildBlob(StateBlobBuilder.java:104)
at com.ibm.ws.hamanager.runtime.CoordinatorComponentImpl$InconsistentDefinedSetHandler.run(CoordinatorComponentImpl.java:1127)
at java.lang.Thread.run(Thread.java:738)
.
[4/23/15 4:50:30:005 CDT] 0000002e DiscoveryRcv I DCSV1031I: DCS Stack DefaultCoreGroup at Member janmsdlxwas04Network\janmsdlxwas04\rma_ABD: Received a connection from an undefined member janmsdlxwas04Network\janmsdlxwas04\vvelig_janmsdlxwas04_bvatnala. Source address is /10.221.90.109.
[4/23/15 4:50:30:039 CDT] 00003a02 CoreGroupProc W HMGR0060W: An error was encountered while obtaining the host and port information for server celig1_janmsdlxwas04_cnataraj on node janmsdlxwas04.
[4/23/15 4:50:30:039 CDT] 00003a02 CoordinatorCo E HMGR0140E: An event indicating that the core group membership is inconsistent was received. Recovery failed. The exception is com.ibm.ws.hamanager.runtime.config.ServerIndexNodeException: serverindex for node janmsdlxwas04 does not contain server celig1_janmsdlxwas04_cnataraj
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses$ServerIndexParser.getServerIndexForServer(CoreGroupProcesses.java:376)
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses.<init>(CoreGroupProcesses.java:135)
at com.ibm.ws.hamanager.runtime.config.CoreGroupConfig.<init>(CoreGroupConfig.java:113)
at com.ibm.ws.hamanager.runtime.config.StateBlobBuilder.buildBlob(StateBlobBuilder.java:104)
at com.ibm.ws.hamanager.runtime.CoordinatorComponentImpl$InconsistentDefinedSetHandler.run(CoordinatorComponentImpl.java:1127)
at java.lang.Thread.run(Thread.java:738)
.
[4/23/15 4:50:54:993 CDT] 0000002e DiscoveryRcv I DCSV1031I: DCS Stack DefaultCoreGroup at Member janmsdlxwas04Network\janmsdlxwas04\rma_ABD: Received a connection from an undefined member janmsdlxwas04Network\janmsdlxwas04\selg_janmsdlxwas04_smadamsetti. Source address is /10.221.90.109.
[4/23/15 4:50:55:066 CDT] 00003a03 CoreGroupProc W HMGR0060W: An error was encountered while obtaining the host and port information for server celig1_janmsdlxwas04_cnataraj on node janmsdlxwas04.
[4/23/15 4:50:55:068 CDT] 00003a03 CoordinatorCo E HMGR0140E: An event indicating that the core group membership is inconsistent was received. Recovery failed. The exception is com.ibm.ws.hamanager.runtime.config.ServerIndexNodeException: serverindex for node janmsdlxwas04 does not contain server celig1_janmsdlxwas04_cnataraj
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses$ServerIndexParser.getServerIndexForServer(CoreGroupProcesses.java:376)
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses.<init>(CoreGroupProcesses.java:135)
at com.ibm.ws.hamanager.runtime.config.CoreGroupConfig.<init>(CoreGroupConfig.java:113)
at com.ibm.ws.hamanager.runtime.config.StateBlobBuilder.buildBlob(StateBlobBuilder.java:104)
at com.ibm.ws.hamanager.runtime.CoordinatorComponentImpl$InconsistentDefinedSetHandler.run(CoordinatorComponentImpl.java:1127)
at java.lang.Thread.run(Thread.java:738)
.
[4/23/15 4:51:08:786 CDT] 0000002e DiscoveryRcv I DCSV1031I: DCS Stack DefaultCoreGroup at Member janmsdlxwas04Network\janmsdlxwas04\rma_ABD: Received a connection from an undefined member janmsdlxwas04Network\janmsdlxwas04\nElig_janmsdlxwas04_pkumar. Source address is /10.221.90.109.
[4/23/15 4:51:08:820 CDT] 00003a04 CoreGroupProc W HMGR0060W: An error was encountered while obtaining the host and port information for server celig1_janmsdlxwas04_cnataraj on node janmsdlxwas04.
[4/23/15 4:51:08:821 CDT] 00003a04 CoordinatorCo E HMGR0140E: An event indicating that the core group membership is inconsistent was received. Recovery failed. The exception is com.ibm.ws.hamanager.runtime.config.ServerIndexNodeException: serverindex for node janmsdlxwas04 does not contain server celig1_janmsdlxwas04_cnataraj
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses$ServerIndexParser.getServerIndexForServer(CoreGroupProcesses.java:376)
at com.ibm.ws.hamanager.runtime.config.CoreGroupProcesses.<init>(CoreGroupProcesses.java:135)
at com.ibm.ws.hamanager.runtime.config.CoreGroupConfig.<init>(CoreGroupConfig.java:113)
at com.ibm.ws.hamanager.runtime.config.StateBlobBuilder.buildBlob(StateBlobBuilder.java:104)
at com.ibm.ws.hamanager.runtime.CoordinatorComponentImpl$InconsistentDefinedSetHandler.run(CoordinatorComponentImpl.java:1127)
at java.lang.Thread.run(Thread.java:738)
local msg_type = read_config("type")
local dt = require "date_time"
local l = require "lpeg"
l.locale(l)
local timestamp = "[" * l.Cg(l.Ct(l.Cg(l.digit^1, "month") * "/" * l.Cg(l.digit^1, "day") * "/" * l.Cg(l.Cs(l.digit^2) / "20%1", "year") * " " * l.Cg(l.digit^1, "hour") * ":" * l.Cg(l.digit^1, "min") * ":" * l.Cg(l.digit^2, "sec") * ":" * l.Cg(l.digit^3, "sec_frac") * " " * l.Cg(dt.timezone, "timezone")) / dt.time_to_ns, "Timestamp") * "]"
local eventEnd = l.P".\n"
local sp = l.P" "
local bigMessage = l.Cg((l.P(1) - eventEnd)^0, "bigMessage")
local msg = timestamp * sp * bigMessage
grammar = l.Ct(msg)
local msg = {
Timestamp = nil,
Type = msg_type,
Payload = nil,
}
function process_message ()
local log = read_message("Payload")
local fields = grammar:match(log)
if not fields then return -1 end
msg.Timestamp = fields.Timestamp
msg.Payload = fields.bigMessage
inject_message(msg)
return 0
end
@trink
Copy link

trink commented Jul 7, 2015

Line 5: You can just add the locale grammars back to l l.locale(l)
Line 7: For the timestamp you could use almost all of the predefined grammars in the date_time module such as date_month, date_mday etc.
Line 8: The capture group serves no purpose
Lines 8, 9: Inconsistent quote style
Line 33: This would store the bigMessage twice, once in the payload and the other as a field (this line, line 20, and 31 can be removed)

@hourback
Copy link
Author

hourback commented Jul 9, 2015

Thank you, @trink! :-)

Looking over them now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment