[lttng-dev] Fast way to clear trace logs and continue tracing?

Jonathan Rajotte Julien Jonathan.rajotte-julien at efficios.com
Wed Dec 14 16:59:18 UTC 2016


Hi Douglas,


On 2016-12-13 09:41 PM, Douglas Graham wrote:
> Hi,
>
> I just started working with lttng recently, so apologies if this is a dumb question.

Welcome!

>
> Suppose I have configured and started a session and have collected a bunch of traces in a trace file.  Now I want to clear those traces but then continue saving new traces using the same session.  Is there a reasonably fast way to do that?

Normally the typical use case is the other way around, you work in 
flight-recorder mode (not touching disk or network) and take "snapshot" 
when needed.

Could you explain what you want to achieve? What is the bigger picture?

>
> What we currently do is "lttng save --output-path=x.cfg; lttng stop; lttng destroy; rm -rf <tracedir>; lttng load --input-path=x.cfg

Are you saving/loading multiple sessions ? Probably not since you use 
"lttng stop" and "lttng destroy directly".

Still, using "lttng save --output-path=x.cfg" will create a directory 
"x.cfg" containing one to multiple sessions configurations.

"lttng load --input-path=x.cfg"  will look into the "x.cfg" folder and 
load all sessions configuration present.

If this is not the behavior you want make sure to give the name of the 
session to both commands.

You systematically remove the traces ? When does this get executed 
(cron, user action, trace size)?
When does the trace data become important? When do you want to keep the 
trace data?

Is it a requirement that the new session have the same name and/or the 
same output path?

>
> But this is very slow in some cases.  The lttng load in particular is extremely slow when Linux is running inside a virtual machine.

I will test that. Not sure what would cause the load command to be slow 
inside a vm particularly.
The " lttng stop" and "rm -rf" are most probably taking more time than 
the load command.

Could you give us more information regarding the configuration you are 
loading? Number of channels, enabled events, type of session (live, to 
disk, streaming).

>    I was hoping that lttng might support a "lttng clear" that could be used to remove all traces from the trace file, but I can't find any such command.

That is an interesting idea.

>
> I note that lttng does support the rotating of trace files when they reach a size limit.  I think that's fairly close to what I want.  If I could force a trace file rotation at an arbitrary time and then simple remove the old rotated log, leaving the new one, that seems like it should do the job.  Except I don't see any way to force a rotation.

Having a way to force a rotation would be something that would make 
sense. Mathieu Desnoyers/Jeremie Galarneau might be able to give more 
information on the feasibility of such a feature.

>
> Any ideas?
>
> Thanks,
> Doug

So far I do not see any dumb questions. :P

Cheers

> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Jonathan R. Julien
Efficios



More information about the lttng-dev mailing list