Skip to content

Commit 0563541

Browse files
committed
Document the new secure logs config format
1 parent 842443b commit 0563541

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

docs/observability/logging/how-to/enable-secure-logs.md

+28-14
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,35 @@ conditional: [tenant, nav]
44
---
55
# Enable secure logs
66

7-
This guide will show you how to enable shipping of secure logs for your application
8-
9-
Some applications have logs with information that should not be stored with the normal application logs. To support this a directory for these logs can be mounted in the application, and the content of logs written here will be transferred to separate indices in Elasticsearch.
10-
11-
!!! warning "Deprecated syntax"
12-
13-
This is guide contains a deprecated syntax for enabling secure logs. With the new syntax all logs will be sent to secure logs when enabled and will not require any special log configuration.
7+
This guide will show you how to enable shipping of secure logs for your application.
148

159
## Prerequisites
1610

1711
If your NAIS team has already at any point produced secure logs, you can skip this step.
1812

1913
If your team has never before produced secure logs, before enabling them for the first time, give a warning in [#kibana](https://nav-it.slack.com/archives/C7T8QHXD3) Slack channel. There are some things that need to be adjusted before a new team can start sending. Remember to include the name of your NAIS team in the message.
2014

21-
## Enabling secure logs [manifest](../../../workloads/application/reference/application-spec.md)
15+
## Configuring secure logs
16+
17+
To enable secure logs for your application, you need to add the following configuration to your application manifest. This will send all logs produced by the application to the secure logs index in Kibana.
18+
19+
???+ note ".nais/app.yaml"
20+
21+
```yaml
22+
spec:
23+
observability:
24+
logging:
25+
destinations:
26+
- id: secure_logs
27+
```
28+
29+
## Legacy secure logs configuration
30+
31+
!!! warning "Deprecated syntax"
32+
33+
This part of the guide contains the now deprecated syntax for enabling secure logs and is subject to removal in the future.
34+
35+
### Enabling secure logs [manifest](../../../workloads/application/reference/application-spec.md)
2236

2337
???+ note ".nais/app.yaml"
2438

@@ -28,7 +42,7 @@ If your team has never before produced secure logs, before enabling them for the
2842
enabled: true
2943
```
3044

31-
## Set log rotation
45+
### Set log rotation
3246

3347
With secure logs enabled a directory `/secure-logs/` will be mounted in the application container. Every `*.log` file in this directory will be monitored and the content transferred to Elasticsearch. Make sure that these files are readable for the log shipper \(the process runs as uid/gid 1065\).
3448

@@ -38,7 +52,7 @@ With secure logs enabled a directory `/secure-logs/` will be mounted in the appl
3852

3953
**If the limit is exceeded the application pod will be evicted and restarted.**
4054

41-
### Example log configuration
55+
#### Example log configuration
4256

4357
Log files should be in JSON format as the normal application logs. Here is an example configuration of JSON logging with a size based rolling file appender in Logback:
4458

@@ -57,7 +71,7 @@ Log files should be in JSON format as the normal application logs. Here is an ex
5771
</appender>
5872
```
5973

60-
## Configure log shipping
74+
### Configure log shipping
6175

6276
Example configuration selecting which logs go to secure logs
6377

@@ -103,7 +117,7 @@ Example configuration selecting which logs go to secure logs
103117
</configuration>
104118
```
105119

106-
## Use secure logs in application
120+
### Use secure logs in application
107121

108122
Using the Logback config below you can log to secure logs by writing Kotlin-code like this:
109123

@@ -122,7 +136,7 @@ log.info("Non-sensitive data here") // Logging to non-secure app logs
122136
See doc on [Logback filters](https://logback.qos.ch/manual/filters.html#evaluatorFilter) and [markers](https://www.slf4j.org/api/org/slf4j/MarkerFactory.html)
123137
See [Example log configuration](#example-log-configuration) for further configuration examples.
124138

125-
### Non-JSON logs
139+
#### Non-JSON logs
126140

127141
If the logging framework used doesn't support JSON logging, it is also possible to use multiline logs in this format:
128142

@@ -134,7 +148,7 @@ If the logging framework used doesn't support JSON logging, it is also possible
134148

135149
Files on this format must be named `*.mlog`.
136150

137-
### Sending logs with HTTP
151+
#### Sending logs with HTTP
138152

139153
If you do not want to have these logs as files in the pod, it is also possible to use HTTP to write logs. POST your log entry as JSON to `http://localhost:19880`
140154

0 commit comments

Comments
 (0)