Home > Mobile >  How to view process logs in Ubuntu
How to view process logs in Ubuntu

Time:06-10

I started a validator on a GCP Ubuntu validator which runs continuously.

When I started the validator with:

sudo mortar server --data-dir ./data-dir --chain genesis.json  --libp2p 0.0.0.0:PORT --nat IP-ADDRESS --seal --price-limit 1 &

all the logs from the process were outputted in my current shell session.

However since closing and reconnecting to the VM I cannot access the logs. I tried reptyr 6460 but get this error

Process 6460 (sudo) shares 6461's process group. Unable to attach.
(This most commonly means that 6461 has suprocesses).

Is there any other way to reconnect to the processes logs in real time?

CodePudding user response:

As Bryan L suggested in a comment using screen did the screen did the trick

apt install screen

screen

Now you can run your program. After disconnecting and reconnecting start screen using:

screen -r

CodePudding user response:

Linux logs will display with the command cd/var/log. Then, you can type ls to see the logs stored under this directory. One of the most important logs to view is the syslog, which logs everything but auth-related messages. Issue the command var/log/syslog to view everything under the syslog.

so:

Open the terminal window on Linux.
For remote Linux server use the ssh command for log in purpose.
Type the ps aux to see all running process in Linux.
Alternatively, you can issue the top command or htop command to view running process in Linux.
  • Related