CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
299 stars 188 forks source link

How to view netopeer2 log on a .log file, command line #1369

Closed Ghghtr7845 closed 1 year ago

Ghghtr7845 commented 1 year ago

How do I view the log in a .log file, and not on the terminal? Is there a way to pipe all these messages into a log file? I tried netopeer2-server -d -v3 | tee -a /var/log/netopeer2.log, but it doesn't work. The message keeps showing up in the terminal and the log file remains empty. How do I make it the server has its own log like syslog

michalvasko commented 1 year ago

Everything should be printed to stderr, not stdout, which is why your command is not working.

Ghghtr7845 commented 1 year ago

But I don't want it to be printed out to stderr, I want it to print out onto a log file.

michalvasko commented 1 year ago

Then learn how to do that, these issues are meant for problems with netopeer2, not basic shell commands. Try

netopeer2-server -d -v3 2>&1 | tee -a /var/log/netopeer2.log
Ghghtr7845 commented 1 year ago

Hello. Thank you for answering but I guess I'm not being clear with my question. I am trying to make a netopeer2-server log that automatically appears at bootup. The netopeer2-server will also automatically start at boot up and does not require any further commands on the terminal line. Kind of like the auth.log. The command netopeer2-server -d does not daemonize and will only prints the current messages and does not update automatically. Right now it seems all of my netopeer2-server messages are automatically directed to /var/log/message via syslogd, and the messages log does update in real time. So I don't know if there is a way to redirect messages from the message log onto my own log, but the problem with that is will it update automatically. Or is there a way to create a netopeer2-server log on boot.

michalvasko commented 1 year ago

The command netopeer2-server -d does not daemonize and will only prints the current messages and does not update automatically.

I do not understand, what do you mean it does not "update"? Even if it does not daemonize, it works and runs normally. Also, you are right that there is no native way of redirecting all the output to a log but using shell for that should not be a problem.