Where does streamlit write the logs? on AWS EC2 with Ubuntu 22 and no web browser

I am trying to deploy a simple hello world application (on AWS EC2 on Ubuntu 22). I have done the following till now.

1)Created and activated the virtual environment.
2)Installed required software libraries.
3)Started the app using the command - streamlit run myFirstStreamlitApp.py --server.headless=true --logger.level=warning 2

I used --server.headless=true because the app is running on an EC2 which has no chrome browser.

The application starts with the following message

2024-01-10 10:54:05.512 Did not auto detect external IP.
Please go to https://docs.streamlit.io/ for debugging hints.

You can now view your Streamlit app in your browser.

Network URL:

5)When I curl the url using curl -v I see the following response. This is not the correct response. How do I get the correct response? Please help! Thanks.

$ sudo su
root@ip-10-211-58-17:/var/snap/amazon-ssm-agent/7780# curl -v

  • Tryingโ€ฆ
  • Connected to ( port 8501 (#0)

GET / HTTP/1.1
User-Agent: curl/7.81.0
Accept: /

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Server: TornadoServer/6.4
    < Content-Type: text/html
    < Date: Wed, 10 Jan 2024 17:54:34 GMT
    < Accept-Ranges: bytes
    < Etag: โ€œ640a88aa3cab5e0011cb98f23c15b1cf6991154798f312c77a0bb927a04dc0cd326539aaefcc5a8c69c48526d70192d026781db0b9f9b5bf0e1cda3506edea22โ€
    < Last-Modified: Tue, 09 Jan 2024 17:58:20 GMT
    < Cache-Control: no-cache
    < Content-Length: 892
    < Vary: Accept-Encoding
  • Connection #0 to host left intact
    <!doctype html>StreamlitYou need to enable JavaScript to run this app.

Looks OK to me. What do you think is wrong with the response?

1)The response is supposed to say hello geeks :slight_smile:
2)Also I am writing logs to a file but it doesnโ€™t seem to write anything.

Am I missing additional folders and files?

I mean /.streamlit folder I added, but does this folder needs something more?

How do I get those files etc?


No, that is maybe what a browser with javascript support would show. But you are not using a browser here. That seems to be the only thing you are missing, a browser.

What I have is
1)Load balancer calling this URL.
2)The code is supposed to write logs to the Disk.
3)When I curl the URL from EC2 and when I call from Load balancer, I donโ€™t see any logs written to the Disk. That is the reason I think the โ€œstreamlitโ€ server is not serving pages correctly.

Your code wonโ€™t run unless a browser connects to your application.