How to redirect the logs to a file?

Hi again,
So after getting my node up and running earlier with the help of this forum I seem to have run into another problem, I’m trying to get the logs flowing into a file as explained here https://documentation.storj.io/resources/faq/redirect-logs

I created a folder in my home directory called logs and in that folder I created a file called node.log

The full path to this file is /home/adam/logs/node.log

I edited the config.yaml (the location of this really should be included in the documentation linked to above) and included the line log.output: “/home/adam/logs/node.log”, saved the file and restarted the storagenode.

This is where it started to go wrong, using sudo docker ps -a I kept getting this:

faf3354772e3 storjlabs/storagenode:beta “/entrypoint” 15 minutes ago Restarting (1) 18 seconds ago storagenode

So I tried log.output: /home/adam/logs (without the quotes) and still it would not start!

Can someone please tell me the exact format required to get this to work?

Many thanks again

Adam

Use the instruction given in the documentation and enter log.output: "/app/config/node.log" in your config.yaml. The log will be stored in the same folder as storage. Then restart your node.

Thanks for the reply,

It says in the instructions

  1. Then edit your config.yaml (you can use nano or vi editor for Linux/MacOS or Notepad++ for Windows) to add (or change) the log location:

This kinda implies you can change the log file location! Plus being a newb I didn’t know where “/app/config/node.log” was as again it’s not explained and it’s just assumed you’re an expert and know these things!

But as you’ve just pointed out where that is I’ll give it a go.

Thanks again.

You can, but the path is from the perspective of the container.

I have the same issue - container keeps restarting if I make this change …

Remove it from config.yaml and its all fine again

Maybe is some sort of permissions issue trying to write the node.log file as the file is not even created…?

Can you show what you entered in config.yaml ?

@nerdatwork I’ve rem’d it out as it screws up but here’s what I had

Docker run :
–mount type=bind,source="/mnt/storjdisk",destination=/app/config \

The ending quote doesn’t seem to match the starting quote. Try to copy paste from documentation

3 Likes

OMG - didn’t notice that! This damn curly quote thing is a PITA!

Works like a charm now!

Thanks!

2 Likes

Does it really work? In your screenshot the line is commented out and should be ignored.

Yep, works.

Fixed the curly quote and removed the comment - all good