Hello all,

I was wondering if there is a best practice or recommended method of creating 
log files for ptp4l? I know output can be sent to syslog or terminal. I also 
saw there was some discussion about a log to file option in the linuxptp-devel 
mailing list but I'm not sure if it was implemented?


I've tried extracting ptp4l messages from syslog but that breaks when a new 
syslog is created.

I can easily save the terminal output to a file but that doesn't include a 
timestamp. To get around this I've been using awk and tee to add in a timestamp 
with the following command:


sudo ptp4l -f ptp4l.conf -s -m -i eth0 | awk '{ print strftime("%c: "), $0; 
fflush();}' | tee ptp4l.log


Which results in output that looks like this:


Thu 07 Nov 2019 10:42:24 AM EST:  ptp4l[5965315.336]: master offset        540 
s2 freq   +3170 path delay     14960
Thu 07 Nov 2019 10:42:25 AM EST:  ptp4l[5965316.337]: master offset       -204 
s2 freq   +2588 path delay     15216
...

I thought this would be my final solution but then I noticed that if I run 
ptp4l along with phc2sys and the slave's system time gets changed, the 
timestamps can appear out of order because they're based off the slave's system 
clock. If the slave system clock is ahead of the master, I get results like 
this:

Thu 07 Nov 2019 10:44:47 AM EST:  ptp4l[5965458.336]: port 1: new foreign 
master xxxxxx.xxxx.xxxxxx-1
Thu 07 Nov 2019 10:44:14 AM EST:  ptp4l[5965462.336]: selected best master 
clock xxxxxx.xxxx.xxxxxx
...

So I'm wondering if there is a way to get a true timestamp value from the 
master clock and use that for my log files instead of the slave's system clock. 
Or if there's a completely different method of doing this, I'm open to that as 
well!

Thanks,
Adam Essling

_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to