tl-its-umich-edu / my-learning-analytics

My Learning Analytics (MyLA)
Apache License 2.0
36 stars 39 forks source link

I1578 having Gunicorn log the IP address #1581

Closed pushyamig closed 1 month ago

pushyamig commented 1 month ago

Fixes #1578

Logging is happening to console Changes from this PR are added to Myla Beta, but can also be tested from locally. Just use a Proxy like ngrok or loophole https://docs.gunicorn.org/en/stable/settings.html#access-log-format

jonespm commented 1 month ago

Cool that this work. I might make a suggestion onto the format so it looks closer to what is output by Django.

%(t)s [HTTP:%(s)s] [%({x-forwarded-for}i)s] "%(r)s" %(L)s

This should display something like this. What do you think?

[31/May/2024:15:26:10 -0400] [HTTP:200] [141.213.175.192] "GET /api/v1/courses/123456/get_user_default_selection/?default_type=resource HTTP/1.1" 0.013691

This is a little more similar to the other log format of

[2024-05-31 15:26:10 -0400] [INFO] [views.py:586] get_course_date_start

pushyamig commented 1 month ago

This should display something like this. What do you think?

Sure, I made changes as per your suggestion.

I'd think the username would display but not sure why not.

I did not notice it. Since we don't have a Shib integration but via LTI so may be that info is not passed to Gunicorn. This is what I can think of.