Skip to content

Commit 8d1e19b

Browse files
authored
Update README.md
1 parent 6ca694e commit 8d1e19b

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,45 @@ terraform destroy
144144

145145
Due to the new (as of early 2024) nature of this AWS configuration, if you are encountering issues with deploying the project on AWS, then please use the old boilerplate and deploy on Heroku or another cloud platform as we have done in the past.
146146

147+
## Setting Up Datadog
148+
149+
Datadog allows for post-deployment logs and traces. Here is a guide to set it up.
150+
151+
1. Create a Datadog account.
152+
153+
2. Add environment variables to the env file.
154+
155+
```
156+
DD_AGENT_MAJOR_VERSION=7
157+
DD_API_KEY=<key>
158+
DD_SITE="us5.datadoghq.com"
159+
DD_ENV=<project_name>
160+
DD_LOGS_INJECTION=true
161+
DD_TRACE_AGENT_URL=http://localhost:4000
162+
```
163+
164+
In Datadog Agent, search “API Keys” and generate a New Key. Use the key to paste into <key>
165+
Name your DD_ENV in <project_name>. This will be useful when querying logs.
166+
167+
3. If not already installed, install the following dependencies.
168+
169+
```
170+
npm install --save dd-trace
171+
npm install winston
172+
```
173+
174+
4. The configDatadog.ts file exports three variables: `logger_info`, `logger_warn `, and `logger_error`. These variables represent different log statuses. Simply add one of these log variables within each function in the format below.
175+
176+
```
177+
logger_info.log('Account Verified');
178+
logger_warn.warn('Logger Initialized');
179+
logger_error.error('Logout');
180+
```
181+
182+
Some examples are shown in login() and logout() functions in auth.controller.ts.
183+
184+
5. Access "Logs" in Datadog Agent and search "env:<project_name>" to find the logs and their timeline.
185+
147186
## Common Problems
148187

149188
Fill in with problem scenario + solution as they arise

0 commit comments

Comments
 (0)