fxnn / gowatch

Configurable logfile analysis for your server.
MIT License
8 stars 2 forks source link

Make predicate syntax more concise #4

Closed fxnn closed 9 years ago

fxnn commented 9 years ago

Currently, predicates work like

where: {
  allof: [{
    field: Message,
    contains: some text
  }, {
    field: Message,
    matches: '%{SOME_PATTERN}'
  }]
}

This could be made a lot more concise by removing the "field" key and mapping fields to conditions instead:

where: {
  Message: {contains: some text, matches: '%{SOME_PATTERN}'},
  not: {Message: {matches: '%{ANOTHER_PATTERN}'}}
}

This of course is at the expense of prohibiting the custom fields not, allof, anyof. Guess we can live with that.