# Logging n8n events to Discord by Jason McFeetors

## Метаданные

- **Канал:** n8n
- **YouTube:** https://www.youtube.com/watch?v=epz5Uo3Zd6Q
- **Дата:** 23.07.2021
- **Длительность:** 9:05
- **Просмотры:** 1,747

## Описание

Jason shows you how to use Discord to host workflow events and errors so that you get real-time notifications and visibility into what is happening on your n8n instance.

## Содержание

### [0:00](https://www.youtube.com/watch?v=epz5Uo3Zd6Q) Segment 1 (00:00 - 05:00)

thanks a lot uh harshal and yes it is friday um thank you very much for letting me uh speak again today and uh today i'm going to talk a little bit about a challenge that i ran into and how i've been using nad to kind of get past some of those issues and see what is really going on behind the scenes sometimes with some of my workflows so quite often i would find out often when a client would tell me or when it was too late that something wasn't working right with one of my workflows something was causing errors so on and so forth and so i started investigating a little bit about well how can i be more aware of what's going on how can i get errors to pop up how can i send event logs somewhere so that i can see them more easily and uh it was actually some of the stuff that harshall was doing with some of the discord stuff that kind of made two and two come together so what i'm going to do is i'm going to share my screen and i'm going to show you a few workflows actually that i've put together and we'll let you see just some of the uh stuff that i'm working on so i'm assuming you can see my screen and what we've got here is i've got the familiar n8n screen interface and i've got a discord that i've set up so i'm not going to go into too much detail about how i've all done this i actually have created a blog post on how this all works and i'll put that into the chat later on and this gives you a step by step on how to build this out for yourself if you find it useful but essentially what i've done is i've created two separate workflows um one i use for doing senior event logs and the other one i use for sending error logs and i've created two different channels in the discord app and in each of the channels i've created web hook integrations so i can take those web hook integrations and i can in my naden instance give them that webhook url and then send text to it so this is some of the stuff that harshal's been showing us so i kind of decided well i'm going to take with the information that we've that we're getting and push it through whenever something happens like an error or i want an event log so this is it that's all there is to it there's really a discord node and i've got a testing node just for checking some stuff out um and what i do is i will call this so i've got a test node here that i used my error testing node so what i will do is i can actually call that event log workflow and the reason i create it as a separate workflow is so that i can call it from multiple different places and that will fire off an event log for me similarly i've also created a i will grab the error log node and again i've got some sample testing information but really this is the important part right here and it does the same thing when it sees an error on a workflow that is set up for it and i'll show you how to set that up in a second it will fire a bit of information off to discord as well so when i will run our my error test as an example you'll note that in here i have to make a change so in the settings i need to put in the error log i'm not sure why it's spinning there it is the error log as my error workflow so anytime that there's an error now in this workflow it will fire to my error log in discord so i'm actually going to activate this and this will take maybe a minute or so and what it's going to do is it'll fire because i've got the crown node it'll fire every minute and when it does it'll do two things it's going to set up my event log parameters and then send a message to the event log and then it's going to fire this function node which i've actually designed to fail so it will cause an error and when that error occurs that will then get automatically pushed to the error log and there we go and it will send that into discord so i'm just going to turn this off because

### [5:00](https://www.youtube.com/watch?v=epz5Uo3Zd6Q&t=300s) Segment 2 (05:00 - 09:00)

if i leave it on it'll keep sending one every minute so as you'll see i got the base information going into the event log the title i can easily modify the message all of this information in here it actually automatically grabs from variables that are pushed to it from the event log set node so all of this you don't have to change it it'll just grab it and send it out similarly here's the uh error log and it goes right into detail as to you know what what uh node uh caused the the note type that caused the problem uh what part of it is the issue here's the values of the keys uh here's the um the name of the error the message that was sent the stack error and then it even gives you a url link so that when you click on it will fire up the actual execution that caused the error within n8n and then we go oh right there there's where the error is and you can go in and look at it so it's very quick and easy to uh to be able to dig up all this information and you're aware of it right in real time you can even have the clients running on your phone and it works just fantastically so you'll get a message you're on the road you can check what's going on and get it resolved rather than having your client tell you that it hasn't been running for the last two weeks um i think i saw a question here earlier somebody was asking is there a particular reason that i'm using discord uh yeah first of all um harsha's my hero i wanted to be just like herschel so i decided to use discord because of all his stuff the other nice thing about discord is that there's no cost associated with it you can create your own discord server and it um it doesn't cost you anything and it's super easy to program uh with any n a single node and a way it goes uh so it takes seconds um to do that type of stuff uh see what else do any other questions uh what kind of data are you dating you think are really important for event logs can you share some light on this so there is um really i use event logs for something that would be critical so if i'm going to be for example uh sending data over to another system and i want to make sure that we reach that point i'll put an event log saying yep this data has been sent over to this other system to air table or what have you and it'll allow me to go in and see what's going on from that perspective i'll often do things when let's say for example it's something that doesn't happen very often and we want to be notified of it so for example if um i have a flow that will turn lights on and it doesn't usually turn lights on or maybe even let's say it's a motion sensor outside that's a great one to send into your event log because you know the light comes on well somebody's out there you get to see it and it sends you that alert right away and again anything that you would look at digging in and finding out just how uh things are working just to make sure they are and sometimes you know when you get no message that's good news sometimes it's bad news so you want to make sure that you can see that as well for those of you who are interested in learning a little bit more about this here is the blog post i'm just going to plug it right into the chat and you can go and take a look at it all the codes there everything uh that you need you should be able to figure it all out from there if not you know where to find me i'd be more than happy to give you a hand and harshall i think it's back over to you

---
*Источник: https://ekstraktznaniy.ru/video/15782*