Skip to content

Commit 9b445cf

Browse files
committed
Add better overview and start on the Loki docs
1 parent 199620b commit 9b445cf

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

docs/observability/README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ The tree pillars of observability are:
2323

2424
```mermaid
2525
graph
26-
A[Application] --> B((Logs))
27-
A --> C((Metrics))
28-
A --> D((Traces))
26+
A[Application] --> B((Logs))
27+
A --> C((Metrics))
28+
A --> D((Traces))
29+
30+
click B "#logs"
31+
click C "#metrics"
32+
click D "#traces"
2933
```
3034

3135
## Metrics
@@ -61,7 +65,7 @@ graph LR
6165
[:octicons-arrow-right-24: Access Grafana here][nais-grafana]
6266

6367
[grafana]: https://grafana.com/
64-
[nais-grafana]: https://grafana.nais.io/
68+
[nais-grafana]: https://grafana.nav.cloud.nais.io/
6569

6670
## Logs
6771

docs/observability/logs/README.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1+
---
2+
description: >-
3+
NAIS offers several mechanisms for collecting and storing logs from your
4+
applications. This page describes the different options and how to use them.
5+
---
16
# Application Logs
27

3-
## Purpose
8+
## Purpose of logs
49

510
Logs are a way to understand what is happening in your application. They are usually text-based and are often used for debugging. Since the format of logs is usually not standardized, it can be difficult to query and aggregate logs and thus we recommend using metrics for dashboards and alerting.
611

712
There are many types of logs, and they can be used for different purposes. Some logs are used for debugging, some are used for auditing, and some are used for security. Our primary use case for logs is to understand the flow of a request through a system.
813

914
Application logs in nais is first and foremost a tool for developers to debug their applications. It is not intended to be used for auditing or security purposes. We do not condone writing sensitive information to application logs.
1015

11-
## Overview
16+
## Good practice
17+
18+
- [x] **Establish a clear logging strategy** for your application. What do you want to log? What do you not want to log? What is the purpose of your logs?
19+
- [x] **Use log levels** to different- [x] **Use log levels** to differentiate between different types of logs. We recommend using the following log levels: `INFO`, `WARN`, `ERROR`, and `FATAL`.
20+
- [x] **Use structured logging**. This means that your logs must be written in a JSON format. This makes it easier to query and aggregate logs.
21+
- [x] **Write meaningful log messages** and attach relevant metadata to your logs. This makes it easier to understand what is happening in your application.
22+
- [ ] **Do not log sensitive information**. This includes personal information, passwords, and secrets. If you need to log sensitive information, use [secure logs](#secure-logs) or [audit logs](#audit-logs).
23+
- [ ] **Do not underestimate the cost and performance** of logging. Logging is a trade-off between observability, performance, and cost. Logging can be computational and financial expensive, so make sure you log only what you actually need.
24+
- [ ] **Do not use rely on logs for monitoring**. Use metrics for monitoring, visualization, and alerting as your first line of defense and use logs for debugging when something goes wrong.
25+
26+
## Technical overview
1227

1328
Logs that are sent to console (also known as `stdout`) are collected automatically by an agent inside the cluster. This agent can be configured to send logs for persistent storage and querying based on team- and application specific configuration.
1429

@@ -24,11 +39,16 @@ graph LR
2439

2540
[FluentD]: https://www.fluentd.org/
2641

27-
## Configuration
42+
## Log collection
43+
44+
Log collection is automatically configured for persistent storage, but can be changed in the following two ways:
2845

46+
1. By changing the default logging destination for all applications in your team namespace (not yet fully implemented)
47+
2. By changing the logging destination for a single application using the `spec.observability.logging.destinations` field in the [nais manifest](../../nais-application/application.md).
2948

49+
The most recent log will always be available in nais console and using the `kubectl logs` command.
3050

31-
## Destinations
51+
#### Log destinations
3252

3353
| Destination | ID | Description | Availability |
3454
| :-------------------------- | :------------ | :--------------------------------- | :----------- |

0 commit comments

Comments
 (0)