Skip to content

Instantly share code, notes, and snippets.

@srid
Created October 7, 2011 22:17
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 srid/1271472 to your computer and use it in GitHub Desktop.
Save srid/1271472 to your computer and use it in GitHub Desktop.
(defn- match-record-type2
"Match the given record to one of defined types and return its extra metadata."
[record]
(first
(filter
(fn [[key [pattern meta]]]
(if-let [groups (next (re-find pattern (:message record)))]
(merge {:event_source :dea
:event_type key}
(if (coll? meta)
(zipmap meta groups)
(meta groups)))))
(seq log-record-types))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment