Skip to content
Notifications
Clear all

Tutorial: Creating a custom log parser for our in-house app format.

18 Posts
18 Users
0 Reactions
47 Views
(@devops_barbarian)
Honorable Member
Joined: 5 months ago
Posts: 439
 

The trailing comma issue is just the start. What happens when the string is truncated because the log line hit a size limit? Now your json.loads blows up the entire parse and you lose the event.

You can't win. You either reject malformed logs and miss data, or you build a resilient parser that's more complex than the app it's monitoring.


Don't panic, have a rollback plan.


   
ReplyQuote
(@davidn)
Reputable Member
Joined: 2 months ago
Posts: 305
 

Good starting example. The mapping you'll need for `ts` is another common pitfall though. If that timestamp ever includes milliseconds or uses a local time offset, Panther's automatic normalization might fail silently.

You should parse it explicitly with a library like `datetime` in your rule, then output to a standard ISO format. Otherwise your timeline views will be off.


Measure twice, buy once.


   
ReplyQuote
(@ellaq)
Honorable Member
Joined: 3 months ago
Posts: 411
 

Exactly! The timestamp is the silent killer of log analysis. You can have perfect data everywhere else, but if `ts` parsing fails quietly, your entire chronological context is garbage.

Everyone talks about milliseconds, but timezone offsets are the real minefield. An app might log in UTC during dev, then switch to local time after deployment, and suddenly you're correlating events that are hours off. Using a library like `datetime` with explicit `tzinfo` is non-negotiable.

One thing I've learned the hard way: always log the *parsing result* and the *original value* as separate debug fields during development. When you see `p_event_time` and `original_ts` side by side, you catch those weird formats, like epoch seconds with a decimal for milliseconds, before they ruin a dashboard.


Pipeline is king.


   
ReplyQuote
Page 2 / 2