Title
m

Muddassir Shaikh

03/24/2022, 5:03 AM
Logs not visible on UI , how to fix this ?
:discourse: 1
a

Anna Geller

03/24/2022, 9:20 AM
Are you on Prefect Cloud? Normally, you should be able to refresh your browser page and see the logs then.
m

Muddassir Shaikh

03/24/2022, 12:44 PM
No, hosted on personal server
a

Anna Geller

03/24/2022, 12:54 PM
hmm could it be there is some issue with your Postgres instance running out of storage and not being able to store logs? checking logs could be informative
m

Muddassir Shaikh

03/24/2022, 12:56 PM
do you know the path where this logs are stored ?
k

Kevin Kho

03/24/2022, 1:46 PM
It’s a
logs
table in the postgresdb
a

Anna Geller

03/24/2022, 1:50 PM
@Muddassir Shaikh what I meant that checking the Server logs would be useful to see If you see any error messages such as "no space left on Disk, couldn't insert flow run logs to the DB"
m

Muddassir Shaikh

03/24/2022, 2:23 PM
while setting up prefect, i didnt specify any database and installation was done automatic, can you guide me with the path of the postgresdb which it uses ?
k

Kevin Kho

03/24/2022, 2:39 PM
If you do
prefect server start
, it uses Docker compose to spin up multiple containers. There will be a postgres container which contains your Flows and metadata and logs
p

Prateek Saigal

03/29/2022, 12:10 PM
@Kevin Kho @Anna Geller We don't see any server errors/postgres errors on the prefect server on the docker logs Also do note that we are experiencing this for one of the agents - rest agents are fine - so don't think it will be a space issue. What else could be the reason for this?
Also what set of username, password and database we should use if we have to connect to the postgresql ?
k

Kevin Kho

03/29/2022, 1:53 PM
If you use prefect server start, it’s here
p

Prateek Saigal

03/30/2022, 5:32 AM
okay can connect to the database and can see the log table but don't see any logs from only one agent
k

Kevin Kho

03/30/2022, 5:37 AM
You mean from the flows run on the agent? Or are you expecting agent logs to show up?
p

Prateek Saigal

03/30/2022, 7:45 AM
I am expecting the logs of the flow runs on the agent
a

Anna Geller

03/30/2022, 8:54 AM
To see flow run logs on the agent, you need to start your agent with a flag --show-flow-logs:
prefect agent local start --show-flow-logs
m

Muddassir Shaikh

03/30/2022, 9:51 AM
@Anna Geller i added showflow log flag still the logs are not visible on the UI. below is my agent startup command:
prefect agent local start -l my_agent_name -n my_agent_name -a <http://hosted_prefect_server_ip>:port -p /home/code/utils --show-flow-logs
a

Anna Geller

03/30/2022, 10:16 AM
can you show the flow code of the flow that doesn't generate logs properly?
if you use print, you need to add log_stdout=True to the task decorator, and to log from tasks, you need to use logger from the context:
@task
def do_sth():
    logger = prefect.context.get("logger")
    <http://logger.info|logger.info>("some msg")
logging within flows is not supported in Prefect 1.0
m

Muddassir Shaikh

03/30/2022, 11:45 AM
naah there is no issue in code as when i run the same code from different agent, logs are shown on UI. But i do see differences in prefect version of those agents
This is fixed now. The issue was with prefect version. The prefect server had prefect version = 0.15.11 and this new agent had version=1.1.0. I downgraded it to 0.15.11 and now logs are visible on UI. Thanks @Anna Geller @Kevin Kho @Prateek Saigal for your time 😄
a

Anna Geller

03/30/2022, 12:37 PM
Great work finding and fixing the issue! 👏