课程: Secure Coding in Go

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Logging and metrics

Logging and metrics

- [Instructor] One of the OWASP Top 10 is security logging and monitoring failures. Sometimes, you won't be able to prevent a security breach, but detecting it and responding to it quickly is the best next option. Logging in metrics are your eyes to production. The standard library has facilities for both logging and metrics. It's up to you to decide what to log and what to monitor. Apart from your application logs that help you detect problem with your application, you should also have security related logs and metrics to help you see if something not kosher is going on. Let's have a look. So here's our code. And we add a metric for bad login attempts. And our login handler is going to increase this bad login attempt, and we're going to increase the bad login attempts if the user and password do not match. Otherwise, we continue as usual. Let's run this code. So, run without debugging, and we're going to view the…

内容