Skip to content

Commit

Permalink
fix: added permission fix for container logs
Browse files Browse the repository at this point in the history
  • Loading branch information
speed2exe committed Nov 6, 2023
1 parent a6f7198 commit 87049aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doc/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ Exiting: error loading config file: config file ("filebeat.yml") can only be wri
- Solution: remove write permission on the file: `chmod -w docker/filebeat/filebeat.yml`

### No Logs
- Observation: There are no logs in OpenSearch Dashboard
- Possibe Diagnostic: No read permission for `*.log` files in `/var/lib/docker/containers`

- One Time Solution: give read permission to docker logs
```
$ docker logs appflowy-cloud-filebeat-1
...Non-zero metrics in the last 30s...
chmod -R a+r /var/lib/docker/containers
```
- Solution: give read permission to docker logs: `chmod -R a+r /var/lib/docker/containers`
- Permanent Solution: give read permission to docker logs every time there's a modification
In the project root directory: `sudo ./docker/filebeat/grant_container_logs_permissions.sh`
- Caveat: Only work on unix like operating system, requires `inotifywait`(`inotify-tools`) to be installed.
MacOS alternative: `fswatch`

## Credentials
- After deployment, when you go to localhost:5601, both username and password will be `admin`
Expand Down
8 changes: 8 additions & 0 deletions docker/filebeat/grant_container_logs_permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env bash

while true
do
inotifywait /var/lib/docker/containers
sleep 1
sudo chmod -R a+r /var/lib/docker/containers
done

0 comments on commit 87049aa

Please sign in to comment.