AntoineGa / Seq.App.Teams

Seq application for Microsoft Teams
MIT License
13 stars 10 forks source link

Howto adapt "Open Seq Alert" link in Microsoft Teams Alert? #12

Open steinii opened 4 years ago

steinii commented 4 years ago

Hi!

I set an Alert condition on my Seq Dashbord with "count > xy". When I receive the Alert in Teams and click on link "Open Seq Alert" I will be forwarded to Seq Log Server Events with my Count query as filter parameter an "xy" as result.

Is there a way to change the "Open Seq Alert" link to get a list of "xy" events wich triggered the Alert?

Kind regards Andreas

tbolon commented 4 years ago

Hi there.

We are interested in the same feature : our goal is to receive alerts, and being able to browse the events.

See the email alert, which does exactly that.

I will try to read the code and see if something can be done.

steinii commented 4 years ago

I tried to debug the Code but didn't do the trick.

How to debug this package with VS2019?

nblumhardt commented 4 years ago

Hi! The property with the URL in question is ResultsUrl, you can see it used in the email app here:

https://github.com/datalust/seq-apps/blob/master/src/Seq.App.EmailPlus/Resources/DefaultBodyTemplate.html#L38

To debug an app, you can use the seqcli app run command and attach a debugger, or, set the command as the startup command line in the project's VS2019 debug settings.

I've copied the command help below:

seqcli app run [<args>]

Host a .NET `[SeqApp]` plug-in

Arguments:
  -d, --directory=VALUE      The directory containing .NET Standard assemblies;
                                defaults to the current directory
  -t, --type=VALUE           The [SeqApp] plug-in type name; defaults to
                               scanning assemblies for a single type marked
                               with this attribute
  -p, --property=NAME=VALUE  Specify name/value settings for the app, e.g. `-p
                               ToAddress=example@example.com -p Subject="
                               Alert!"`
  -s, --server=VALUE         The URL of the Seq server, used only for app
                               configuration (no connection is made to the
                               server); by default the `connection.serverUrl`
                               value will be used
      --storage=VALUE        A directory in which app-specific data can be
                               stored; defaults to the current directory

Hope this helps!

steinii commented 4 years ago

Hi! Thank you for your reply!

Unfortunately the Symbols won't be loaded in VS2019 and breakpoints won't be hit if I attach a debugger to any process, regardless of whether it is "seqcli app run" or the "seq server" running locally :-/

steinii commented 4 years ago

The property with the URL in question is ResultsUrl

That is exactly what I will not see. In my case the Alert is triggered by a count > x and the ResultUrl provide only the number "x" to me.

nblumhardt commented 2 years ago

I think this should be re-titled "Alerts Support"; I've done some work to update the Slack app to show all features of the existing and forthcoming (Seq 2021.3) notification formats. Aiming to do the same here, and will start on a PR as soon as we can get the app publishing through CI again 👍

AntoineGa commented 2 years ago

CI should work now.

nblumhardt commented 2 years ago

Awesome, thanks @AntoineGa!

nblumhardt commented 2 years ago

Re-reading this, I think I misunderstood the original request 😅.

You can browse the events that contributed to an alert in Seq by following the ResultsUrl, and then removing everything but the where clause of the SQL query from the filter bar.

This isn't a great experience, though, which is one of the reasons we've updated alerts in Seq 2021.3. For a 2021.3 alert, it's possible to specify a number of events to include in the notification. These get sent through by email, Slack, Teams, etc. and can be examined directly in the notification.

E.g. two contributing events are included in this:

image

The events themselves are hyperlinked back to Seq, so they're easier to examine in addition to the ones underlying the ResultsUrl query.

tormodfj commented 2 years ago

For a 2021.3 alert, it's possible to specify a number of events to include in the notification. These get sent through by email, Slack, Teams, etc. and can be examined directly in the notification.

Running Seq 2022.1 and Seq.App.Teams 2.0.48, contributing events are in fact not examinable directly in the Teams notification:

image

You can browse the events that contributed to an alert in Seq by following the ResultsUrl, and then removing everything but the where clause of the SQL query from the filter bar.

This is the approach I use for now, but it is very clunky, especially on mobile. If the contributing events were shown directly in the Teams notification (like in the Slack screenshot), it would allow for quick and easy triaging of alerts directly from the Teams mobile app, rather than fetching my laptop or attempting to browse the Seq interface on my phone.