In this module, we will talk about monitoring APIs through Metrics and Logging. With API Gateway, you automatically have Metrics for your APIs. You can also use the public logging service to get Access and Execution logs. And for more advanced cases you can also use Logging Analytics. Let's take a look at how metrics and logging work with API Gateway. Okay, we've been working with our APIs for a while now, but one of the most important parts of an API Gateway is logging and monitoring. We need to be able to understand what's going on. So let's go ahead and take a look at that. So if I go back into my API Gateway under Developer Services. API Management and Gateways. And I'll go ahead and select my L100 Gateway. We'll see is all long as we've been sending requests, we're getting metrics that are coming through. So there's a couple of levels here. One is we can go ahead and look at metrics, we can look at it at the Gateway level. We can also look at it at the Deployment levels. So if we had multiple deployments we can look at each separate deployment that they're doing. API Gateway is a core component of the platform of ORACLE Cloud infrastructure. And so like all of the other services with oracle cloud infrastructure, it uses a common metrics system. So, in this case, we have these charts that are here but we can go in and we can actually look at the Metrics Explorer. And we can run a number of different reports and that we would with others or taking a look at that. But another element that we want to look at as logging, how do you log information? And so for that, we can Enable logging. So in this case what we'll do is we'll go ahead and use the public logging service and we'll go ahead and select logging default is fine. So we'll go ahead and enable logging. And in this case what we'll do is do both access and execution, logging. Access and Execution logging is slightly different. Access logging is essentially just when a client has requested access to the API. So it's just kind of your front-end request. Execution gives a little more detail about how the request went to a back end and what kind of response that they got there. Okay. So now both of my access and execution logs are active and so it calls to the API will be logged. So what I want to do is go ahead and send some traffic to the API. So that we can go ahead and see what comes into the log. So I will switch over into my terminal and I'll run kind of the batch testing client and I'm going to just send a number of requests. So what's doing is this is sending traffic. We're hitting rate limits, we're getting some requests through. We're just sending traffic through. So we'll just go ahead and fire these requests and for a little bit. And then what we'll do is we'll go in and take a look at what shows up in the logs, okay? So we have a pretty good amount of volume at least to start taking a look at let's go and take a look at the access log. We'll go into field service access. This will switch us over into the public logging service be used for API Gateway but also can be used for all kinds of traffic, right? So you can have all different types of systems. So what you see here is this is kind of like a like web access. So this is what's coming in the request, the remote address. All the requests get tagged in with the request ID that can be correlated. And of course, we can kind of see what's going on that these are all these get request that have come in here. We should see there's a status 49. So you can even do some searching, right? So if we were to explore with log search we can come in here we can say okay let's go ahead and go data.status equals, how many? 49s did we get, right? So we can start to see we can start to do kind of research to see what happened there as we're getting that. So this is not just looking at the raw log file. This is also using all of the searching mechanisms that we have that we can work with that. So let's go ahead and go back to our logs. And we can look at the execution log just to see what was coming in there. So here what we can see is we had some requests as a missing authorization token. So in the tester I wasn't using the authorization token. So when the request came in, it essentially said now there's it's the Gateways rejecting the request that we're seeing there. So we were getting 401 and 429 pretty consistently. So that's access and execution, logging that comes right out of the box with API Gateway and using the public logging service. So let's take a look over at logging analytics. And to do that, I'm going to go over into another tendency where I have logging analytics set up, okay? So we switched over into another tendency where we have some different kind of traffic. Some different use cases set up and we'll just take a look real quick. So if we look in developer services, API management, and Gateways which we'll see as I have a different gateway that I have set up here and you can see I've just started to send some traffic through this Gateway showing in this test. We were to go look at this traffic a little bit more, we can delve into this with the Metrics Explorer. What we can see is there's a good amount of requests going along through this. So we can see a number of different services that we have record, all kinds of different operations that are running through here. So let me go ahead and go over into Logging Analytics. So we'll go into dashboards. What we'll do is we'll pick one of our dashboards that's in our route compartment here. And what we'll be able to see is not just API Gateway. But also a bunch of other services that we're executing. So you can see we have, where we're invoking functions this is through API Gateway. But where we're using functions and we can kind of see what's going on there. We can do a fair amount of analysis. So some of the things we can do here is we can see is the different statuses of what's going on. So you can see we may have 2 of 2 here, we can actually kind of sorting services. So for example, I can take all of these out and say I want to know where my rate limits happened. Looks like rate limiting is not happening too much is happening in field service though. Out of these three APIs field service help to ask insurance I'm seeing that. What about 405s that's happening wrong methods, something is going on in insurance and I can go and delve into those as well, 201s different things. So I can actually analyze the data as we're going through here. Another thing I because and do is I can go into the log explorer and here I can do all manner of analysis. So for example, if I want, I can go in and start to expand out my other fields. So for example, instead of going into doing this by log source, I could go and group this by status, go ahead and apply that. And then what I can see is all the different statuses and of course I can change this the way this goes. So let's just say I want to put this into a tree, map. What I can see is I have a number of statuses some are records because these will be functions. May not report that or other services rather will not report the kind of status that we're using here. But I can see this with the Gateway. So if I start to see something start to grow and I can get into that and take a look at that. So like for example, what happened in the 49s? I can go and delve into those logs and analyze this. So this really provides a really good way to build rich dashboards and monitoring and managing API Gateway. But this is the same platform that can be used for things like BCN, flow logs, all kinds of other services, whether you're running, just different databases or middlewares or anything as a whole wide range of log parcels that are available for logging analytics that you can use along with API Gateway to build holistic dashboards, to monitor and manage your technology portfolio. And that's monitoring and management with API Gateway.