turbinia icon indicating copy to clipboard operation
turbinia copied to clipboard

API Server logging paths

Open wajihyassine opened this issue 2 years ago • 6 comments

Per our past chat around this creating this as reference, ideally would like the api server to log into the LOG_DIR directory for easier reference, currently seems to be done in /var/log/supervisor. Also it doesn't seem like the log line for mounting the Web UI gets recorded anywhere which makes it a little difficult during testing/seeing issues with web mount if its also possible to record this as well/may be affecting any other log lines we have outside of FastAPI request logging.

Also the other part from chat is to have new Turbinia variable with Web mount path rather than trying to look for it relatively. I think best to set it by default to /tmp/web and then I can make adjustments in Docker container to write Web dist to /tmp/dir . I used os.path.join in other parts of Turbinia code as an FYI, pathlib seems similar but if we wanted one less library small nit. Also a log line indicating that the Web UI was successfully mounted would be helpful.

wajihyassine avatar Oct 13 '22 17:10 wajihyassine

Looking into this, I believe the logging issue is caused by supervisor redirecting stdout/stderr to its own file(s). We have two options, a) can modify supervisor config to log stdout/stderr to a specific file path (we'd need to figure out a way to edit the config file in the container to match LOG_DIR), b) we can completely remove supervisor since the plan now is to have a separate container for the api server and oauth2 proxy, and the purpose of supervisor was so we could just start one daemon instead of multiple on the same running container.

For the Web UI comments, the api-client branch contains some changes that do not require 'mounting' the directory. Instead, the files are served using a FileResponse. I'll add a WEBUI_PATH configuration option that defaults to /tmp/web. Will the static files be stored directly at that path? E.g. /tmp/web/index.html or under /tmp/web/dist/index.html ?

jleaniz avatar Oct 18 '22 15:10 jleaniz

For what it's worth, I like supervisor because it can auto restart the app if it crashes for whatever reason, but we would seldom need this option plus we can monitor for this with Prometheus maybe?

jleaniz avatar Oct 18 '22 15:10 jleaniz

Thanks for looking into this and sg on Web UI mounts it'll be copied over as '/tmp/web/dist'. Yeah tbh I don't think we'll need 'supervisor' for that part since both kubernetes and I believe docker can auto restart containers + monitoring in future. Makes sense to why initially put in but I think separating oauth2 proxy from api server will be way to go

wajihyassine avatar Oct 18 '22 16:10 wajihyassine

As discussed out-of-band, this will be addressed in the api client PR. Will close this out once that PR is merged/finalized.

jleaniz avatar Oct 31 '22 17:10 jleaniz

Updating description given #1200. Still would be nice to have logging go to LOG_DIR and then can expect the WEBUI_PATH in the turbinia config with the api-client PR.

wajihyassine avatar Dec 21 '22 23:12 wajihyassine

Went ahead and included default web path in #1223 since also updating web versions there/ran into this during testing.

Updating this bug to just take into account sending API logs to the LOG_DIR

wajihyassine avatar Jan 11 '23 19:01 wajihyassine