Skip to content

Commit

Permalink
feat: add logging for security baseline (#166)
Browse files Browse the repository at this point in the history
Adds logging to comply with security baseline requirements.

Co-authored-by: Grant Duncklee <[email protected]>
  • Loading branch information
gduncklee and Grant Duncklee authored Apr 17, 2024
1 parent 1a9f7d5 commit d4e3097
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /usr/app

RUN pip install poetry

COPY poetry.lock pyproject.toml alembic.ini ./
COPY poetry.lock pyproject.toml alembic.ini log-config.yml ./

RUN poetry config virtualenvs.create false
RUN poetry install --no-root
Expand All @@ -16,4 +16,4 @@ WORKDIR /usr/app/src

EXPOSE 8888

CMD ["uvicorn", "sbl_filing_api.main:app", "--host", "0.0.0.0", "--port", "8888"]
CMD ["uvicorn", "sbl_filing_api.main:app", "--host", "0.0.0.0", "--port", "8888", "--log-config", "log-config.yml"]
34 changes: 34 additions & 0 deletions log-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 1
disable_existing_loggers: False
formatters:
default:
"()": uvicorn.logging.DefaultFormatter
format: '%(levelprefix)s [%(asctime)s] %(message)s'
use_colors: null
datefmt: '%d-%m-%Y %H:%M:%S'
access:
"()": uvicorn.logging.AccessFormatter
format: '%(levelprefix)s [%(asctime)s] %(client_addr)s - "%(request_line)s" %(status_code)s'
datefmt: '%d-%m-%Y %H:%M:%S'
handlers:
default:
formatter: default
class: logging.StreamHandler
stream: ext://sys.stderr
access:
formatter: access
class: logging.StreamHandler
stream: ext://sys.stdout
loggers:
uvicorn:
level: INFO
handlers:
- default
propagate: no
uvicorn.error:
level: INFO
uvicorn.access:
level: INFO
handlers:
- access
propagate: no

0 comments on commit d4e3097

Please sign in to comment.