gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)

Home Page:https://gotify.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there an access log?

d03j opened this issue · comments

commented

Have you read the documentation?

  • [X ] Yes, but it does not include related information regarding my question.
  • Yes, but the steps described in the documentation do not work on my machine.
  • Yes, but I am having difficulty understanding it and wants clarification.

You are setting up gotify in

  • [ X] Docker
  • Linux native platform
  • Windows native platform

Describe your problem

Any errors, logs, or other information that might help us identify your problem

Ex: docker-compose.yml, nginx.conf, android logcat, browser requests, etc.

Name of the information here

n/a

Yeah, it is logged to standard out.

commented

Thanks. I get noting after podman gotify.

I'm running 2.4.0, started by:

podman run --replace --name=gotify -d \
  -e TZ=$GLOBAL_TZ \
  --pod $PODNAME \
  --net $NETWORKSTRING \
  -v $GOTIFY_DIR/data:/app/data \
  -p $GOTIFY_PORT:80 \
  docker.io/gotify/server:latest

Am I missing something?

Probably something like

podman logs gotify

See podman documentation.

commented

sorry, that's what I meant by podman gotify: it was actually podman logs gotify!

Upon further inspection, I just realised podman logs is not returning any output for any of my containers. So the issue seems to be with podman.

commented

sorry. that's no true. some containers don't seem to show anything when I do podman logs, but others do.

$ podman logs whoami
2023/10/26 18:43:39 Starting up on port 80
2023/10/26 18:43:44 Starting up on port 80
2023/10/31 22:45:31 Starting up on port 80

Works for me.

$ sudo podman run  --name=gotify -d -v ~/src/playground/gotify/data:/app/data -p 80:80 docker.io/gotify/server:latest
c8ff083e03947a4febb146ba456c2662cb1c3a86158b641c46fe1a91660aa46f
$ sudo podman logs gotify
Starting Gotify version 2.4.0@2023-09-17-08:24:00
Started Listening for plain HTTP connection on :80
2023-11-01T13:28:32Z | 200 |     291.416µs |       10.88.0.1 | GET      "/"
2023-11-01T13:28:32Z | 200 |    1.994447ms |       10.88.0.1 | GET      "/static/css/2.0f3898ba.chunk.css"
2023-11-01T13:28:32Z | 200 |    2.719047ms |       10.88.0.1 | GET      "/static/js/main.f445756e.chunk.js"
2023-11-01T13:28:32Z | 200 |   25.122091ms |       10.88.0.1 | GET      "/static/js/2.a296d629.chunk.js"
2023-11-01T13:28:32Z | 401 |     218.017µs |       10.88.0.1 | GET      "/current/user"
Error #01: you need to provide a valid access token or user credentials to access this api
2023-11-01T13:28:32Z | 200 |     118.385µs |       10.88.0.1 | GET      "/static/media/roboto-latin-400.176f8f5b.woff2"
2023-11-01T13:28:32Z | 200 |       77.77µs |       10.88.0.1 | GET      "/static/media/roboto-latin-500.f5b74d7f.woff2"
2023-11-01T13:28:33Z | 200 |       89.05µs |       10.88.0.1 | GET      "/static/favicon-196x196.png"
2023-11-01T13:28:33Z | 200 |      11.282µs |       10.88.0.1 | GET      "/static/favicon-16x16.png"
2023-11-01T13:28:33Z | 401 |     163.158µs |       10.88.0.1 | GET      "/client"
Error #01: you need to provide a valid access token or user credentials to access this api
2023-11-01T13:28:33Z | 401 |     145.957µs |       10.88.0.1 | GET      "/current/user"
Error #01: you need to provide a valid access token or user credentials to access this api
2023-11-01T13:28:33Z | 401 |      20.783µs |       10.88.0.1 | GET      "/client"
Error #01: you need to provide a valid access token or user credentials to access this api
commented

thank you. what podman version are you running? I've tried to run 4.6.2 as root and rootless (the reason I use podman instead of docker in the first place) with no luck.

$ podman version
Client:       Podman Engine
Version:      4.7.1
API Version:  4.7.1
Go Version:   go1.21.1
Git Commit:   ef83eeb9c7482826672f3efa12db3d61c88df6c4-dirty
Built:        Fri Oct  6 11:12:34 2023
OS/Arch:      linux/amd64

Is the gotify container running podman ps?

commented

yes. I can send messages to it and all. unfortunately I'm running ubuntu 22.04 and have the kubic repo so I can get to podman 4...

$ podman version
Client:       Podman Engine
Version:      4.6.2
API Version:  4.6.2
Go Version:   go1.18.1
Built:        Thu Jan  1 10:00:00 1970
OS/Arch:      linux/amd64

Could you try run'ning the gotify image with --log-driver json-file? E.g.

podman run  --replace --name=gotify -d -v ~/src/playground/gotify/data:/app/data -p 80:80 --log-driver json-file docker.io/gotify/server:latest

and verify if the log works?

commented

It does! Thank you!

$ podman logs gotify
Starting Gotify version 2.4.0@2023-09-17-08:24:00
Started Listening for plain HTTP connection on :80
2023-11-05T09:02:04+11:00 | 200 |   83.895571ms |   192.168.0.205 | GET      "/"
2023-11-05T09:02:05+11:00 | 200 |  204.585058ms |   192.168.0.205 | GET      "/static/css/2.0f3898ba.chunk.css"
2023-11-05T09:02:05+11:00 | 200 |  203.380579ms |   192.168.0.205 | GET      "/static/js/main.f445756e.chunk.js"
2023-11-05T09:02:05+11:00 | 200 |  382.025282ms |   192.168.0.205 | GET      "/static/js/2.a296d629.chunk.js"
2023-11-05T09:02:06+11:00 | 200 |     523.037µs |   192.168.0.205 | GET      "/static/favicon-196x196.png"
2023-11-05T09:02:06+11:00 | 200 |     140.473µs |   192.168.0.205 | GET      "/static/favicon-16x16.png"
commented

I know this is a podman question, but do you know a way to have the logs written to a file at a specific location?

Executing podman inspect --format='{{.HostConfig.LogConfig.Path}}' gotify gives me a ctr.log file under $HOME/.local/share/containers/storage/overlay-containers//userdata. The problem is my container id will change from time to time and I need it to be on a predictable location.

To summarize the original problem, podman isn't able to log into the default log-driver (probably journald) this could be because of the rootless execution and missing permissions.

See podman docs for your question: https://docs.podman.io/en/latest/markdown/podman-run.1.html#log-opt-name-value

commented

Thank you! To summarise the solution:

podman run  --replace --name=gotify -d -v ~/path/to/gotify/data/on/host:/app/data -p 80:80 --log-driver json-file --log-opt path=/path/to/gotify.log docker.io/gotify/server:latest