= babeltrace2-query(1)
:manpagetype: command
:revdate: 14 September 2019


== NAME

babeltrace2-query - Query an object from a Babeltrace 2 component class


== SYNOPSIS

[verse]
*babeltrace2* [<<gen-opts,'GENERAL OPTIONS'>>] *query* [opt:--params='PARAMS']
            'COMP-CLS-TYPE'.'PLUGIN-NAME'.'COMP-CLS-NAME' 'OBJECT'


== DESCRIPTION

The `query` command queries the object named 'OBJECT' from the component
class named 'COMP-CLS-NAME' of the type 'COMP-CLS-TYPE' found in the
Babeltrace~2 plugin named 'PLUGIN-NAME' and prints the results.

include::common-see-babeltrace2-intro.txt[]

The available values for 'COMP-CLS-TYPE' are:

`source`::
`src`::
    Source component class.

`filter`::
`flt`::
    Filter component class.

`sink`::
    Sink component class.

The exact object names and the parameters that a given component class
expects are described in its own documentation. man:babeltrace2-help(1)
can generally provide this information.

You can use the opt:--params option to pass parameters to the component
class's query operation.

The output of the `query` command can look like https://yaml.org/[YAML],
but it's not guaranteed to be YAML-compliant.

See <<examples,``EXAMPLES''>> for usage examples.


== OPTIONS

include::common-gen-options.txt[]


=== Query parameters

opt:-p 'PARAMS'::
opt:--params='PARAMS'::
    Set the query parameters to 'PARAMS'.
+
--
include::common-cmd-params-format.txt[]
--


include::common-cmd-info-options.txt[]


[[examples]]
== EXAMPLES

.Query the available tracing sessions of a local LTTng relay daemon.
====
[role="term"]
----
$ babeltrace2 query src.ctf.lttng-live sessions \
                    --params='url="net://localhost"'
----
====

.Query the metadata info (includes the decoded plain text) of a CTF trace located on the local file system.
====
[role="term"]
----
$ babeltrace2 query src.ctf.fs metadata-info \
                    --params='path="/path/to/trace"'
----
====

.Query the trace infos of a CTF trace located on the local file system.
====
[role="term"]
----
$ babeltrace2 query src.ctf.fs babeltrace.trace-infos \
                    --params='path="/path/to/trace"'
----
====

.Query some object from a sink component class without parameters.
====
[role="term"]
----
$ babeltrace2 query sink.my-plugin.my-sink some-object
----
====


include::common-cli-env.txt[]


include::common-cli-files.txt[]


include::common-cmd-footer.txt[]


== SEE ALSO

man:babeltrace2-intro(7),
man:babeltrace2(1)
