[lttng-dev] How to use the log rotation correctly?

Jeffrey Chen cpthk at live.com
Tue Mar 1 23:12:42 UTC 2016


Hi LTTng community:


LTTng supports trace rotation by having flags "--tracefile-size", "--tracefile-count".  What is the correct use case on using the rotation files?

What we want to do is, without stopping the session, and collect the completed traces (reached file max size), and output the traces using babeltrace in a loop.


While I am trying to implement this, I have noticed that LTTng sometimes would not write the metadata file (file size 0), even the trace files are being rotated off. Without the metadata file, babeltrace would not function. I am wondering whether I am using the trace rotation in the correct way. Is there a way to make sure that when a trace file is being rotated off, metadata is also flush?


I have done some studies on the metadata file. It looks like LTTng is using the stream based metadata file, which would write a packet header for each packet. I noticed some events definitions will be cut off in the middle, the first half at the previous packet, and second half at the next packet. Do we know when LTTng writes metadata, would it always write the complete events definitions? (i.e. first half and second half of the event definition are BOTH in the metadata file) Would it be possible that LTTng only write the first half of the definition, and second half will be written in the next cycle of the flush. I ask this because, when we collect the traces, the session is still running, and I need to confirm metadata file is in the read-able state.


Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20160301/c843dc00/attachment-0001.html>


More information about the lttng-dev mailing list