google / nsjail

A lightweight process isolation tool that utilizes Linux namespaces, cgroups, rlimits and seccomp-bpf syscall filters, leveraging the Kafel BPF language for enhanced security.
https://nsjail.dev
Apache License 2.0
2.96k stars 275 forks source link

Add millisecond precision to nsjail logs #206

Open phoebetse opened 2 years ago

phoebetse commented 2 years ago

I'd like to see logs with timestamps with millisecond precision.

I'm not super familiar with C++, but I think https://github.com/google/nsjail/blob/master/util.cc#L311 is where the change would need to be. It looks like the timeToStr utility function is outputting a string to second precision, so maybe using something like gettimeofday as mentioned on stackexchange would work?

Would a change like this make sense? If so, I'm happy to take a stab at it.

disconnect3d commented 1 year ago

Hi,

I think it would make sense and while I am not a maintainer, I think it may get merged :P.