[lttng-dev] Trace-file size and flight record mode
Daniel.Thibault at drdc-rddc.gc.ca
Thu Jan 23 09:33:02 EST 2014
Date: Thu, 23 Jan 2014 14:06:03 +0530
From: Anand Neeli <anand.neeli at gmail.com>
To: "lttng-dev at lists.lttng.org" <lttng-dev at lists.lttng.org>
> can anyone help me with these queries. These are related to trace modes and file sizes.
> I use the following commands to trace
> ./lttng enable-channel mychannel --userspace --buffers-pid -s mysession
> ./lttng enable-event --channel mychannel --userspace --all -s mysession
> here are my queries
> 1) Trace file should be limited to some defined size and should be overwritten after it reaches max size.
> I want to retain latest N bytes of traces.
> can anyone pls provide more details and the command to enable this?
lttng enable-channel mychannel -u --buffers-pid -s mysession --tracefile-size N --tracefile-count 1
This will limit each mychannel_n file to N bytes. If running on multiple CPUs, you get multiple mychannel_n files, each limited to N bytes. And each process ID will have its trace file limited separately. Further, you won't capture "the last N bytes of events"; rather, every time the file is filled, it gets wiped and a new set of event records begins being captured. If you were to use say --tracefile-size M --tracefile-count 8 (where M is N/8), you would guarantee keeping at least 7M bytes' worth of events in the trace.
> I see -C and -W options. But will the files be overwritten to maintain latest traces?
> and if i use "-W 4" will it create 4xN bytes of latest traces?
Yes, -W 4 creates 4 files of size -C N each. LTTng would write file 1, file 2, file 3, file 4, then overwrite file 1, then file 2, etc.
Note that when you babeltrace this, you will get what seems to be spurious "discarded events" warnings. This may be a bug (using LTTng 2.3.0).
> 2) Flight recorder mode
> If i'm not wrong "Flight recorder mode" continuously overwrite the data in the memory buffers, instead of flushing it to a file on disk.
> How to flush this memory buffer to file to see the traces or is there a way to read this memory?
If by "flight recorder mode" you mean 'lttng create --snapshot', you use the 'lttng snapshot record' command to take the snapshots (copy the buffers to trace files). See the man pages.
Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
R & D pour la défense Canada - Valcartier (RDDC Valcartier) | Defence R&D Canada - Valcartier (DRDC Valcartier)
2459 route de la Bravoure
Québec QC G3J 1X5
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
More information about the lttng-dev