Event Schedule v1.0.10 - Date calculation expressions!

After posting the last release of Event Schedule earlier today, I gave some more consideration to the implications of how the date calculations work. 

The problem, as touched on in the post, is that not all date calculations are equal. If, on the first of January 2022, I expect that Event Schedule will apply { MMMM-1} {yyyy} and return December 2021 - I'm going to be disappointed.  That's a simple example, as is the last day of a given month - we can't calculate dates in isolation for some case.

I thought about baking in a "month" filter to Event Schedule, so you could do multiple instances of the same schedule for scenarios. But to be frank - that sucks.

So I spent a little more time to better support the more complex scenarios. 

In short, Event Schedule will now accept formatted date strings with a modifier at the end. There is a caveat - these strings must be capable of being formatted as .NET custom date strings - excepting, of course, the calculation that is permitted at the end.

In short, you will specify date strings, and (optionally) append a calculation to the end. The following examples would be valid (and are used as test cases):

  • {d M y+10d} - Add 10 days, with an example output 1 1 21.
  • {dd MM yy+10m} - Add 10 months, with an example output 01 11 21.
  • {dd MMM yyy+10y} - Add 10 years, with an example output 01 Jan 2021.
  • {MMMM yyyy-1m} - Subtract 1 month, with an example output December 2020.

In short - the calculation is based on adding or subtracting a number of d (days), m (months), or y (years). This will allow for more power in calculations - still with some possible limitations, but ones that could only be answered with date  expressions (such as "last day of month"). I'm not sure that's strictly necessary for most usages.

We allow "/" and "-" as separators within the date expression, so {d-M-y}, {d/MM/yy}, and {dd MMM yyyy} are all valid. As noted - the date calculation is optional, so you can structure a formatted date with no calculation as a result of this change.

We also allow for the short or long day name to be prepended, with ddd or dddd:

{ddd d MMM yyyy}

Day is optional, but month and year are always required in these date expressions. If you want to specify just month or year - use the simple date tokens.

Hopefully this helps make it even easier to use Event Schedule to log a formatted event to be handled by your Seq apps! I think it's now quite likely that these capabilities will make their way to Event Timeout and Event Threshold to allow you to include dates in your configured log messages.

You can update your existing install from within Seq, install Event Schedule to your Seq instance using the Seq.App.EventSchedule Nuget tag, or otherwise - fanciness ensues below:

Comments

You may also like:

Event Timeout for Seq v1.4.2 released

A new release of Seq.App.EventTimeout is out. This was a little earlier than I planned to release v1.4.x, but there was a bug in the AbstractAPI deserialization as a result of some code refactoring which I'd missed. As usual, you can install Event Timeout for Seq using Seq.App.EventTimeout as the...

Seq Reporter - Turn your structured logs into scheduled reports!

Uhh ... You want what? So, you have all your apps logging to Seq, perhaps you have monitoring and alerting using apps like the Seq OpsGenie client, and maybe you're even using Event Timeout to detect events that didn't happen in time. Things are going great, except ... Well, management...