Search specification
This feature is for Early Access Program customers only
LaunchDarkly’s observability features are available to members of LaunchDarkly’s Early Access Program (EAP). To request early access, sign up here.
Overview
This topic explains how to use LaunchDarkly’s observability search feature to query and filter data across your application. The search functionality allows you to find specific sessions, errors, logs, and traces by composing queries with different properties and attributes.
Compose search queries
Compose your search query with one or more expressions. Each expression can be a comparison between a key and a value, or a logical combination of other expressions.
Here are some examples of search queries:
Enter a search value without a key to search on a default key. For logs, the default key is the message, and for traces it is the span_name
.
You can also filter for custom attributes you send in sessions, logs, and traces.
Keys and values
Keys are identifiers, which can include any combination of alphanumeric characters, underscores (_
), periods (.
), dashes (-
), and wildcards, which are indicated by asterisks (*
).
Values are strings with any character. To use spaces or special characters, you must enclose the string in quotes ("
, '
).
You can use wildcards (*
) in values to match on part of a pattern. For example:
span_name=gorm.*
matches allspan_name
values that start withgorm
.span_name=*.Query
matches allspan_name
values that end with.Query
span_name=*orm*
matches all values that containorm
If you want to use a value with a space or special character, you must wrap the value in quotations.
Regex expressions
You can search with regex expressions by using the matches query operator: =\[your regex here]\
. For example:
clickTextContent=/\w.+\w/
matches allclickTextContent
that start and end with any wordbrowser_version=/\d\.\d\.\d/
matches allbrowser_versions
in the form [0-9].[0-9].[0-9]
If you want to use a regex expression with a space or special character, you must wrap the value in quotations. For example:
tag="/\w \w/"
visited-url="/https://app.launchdarkly.com/\d/.+/"
Comparisons
Use operators to compare two different elements in your search query. The following operators are supported:
=
: Equals!=
: Does not equal<
: Less than<=
: Less than or equal to>
: Greater than>=
: Greater than or equal to
Exist and does not exist
You can search if a key exists or does not exist with the exists
operator. For example, to return all the traces with a connected session, use the following query:
exists
also works with the not
keyword. For example, when you only want the root level spans when searching traces, use this query:
You can combine expressions with the logical operators AND
, OR
, and NOT
:
AND
: Both expressions must be trueOR
: At least one of the expressions must be trueNOT
: The following expression must be false
There is an implicit AND
between all filters unless you specify an OR
directly. For example:
This is equivalent to:
You can also use parentheses ( AND )
to group values in an expression. For example:
You can also use parentheses to group values in an expression:
Saved searches
Saved searches are a set of search filters that apply to sessions or errors. Saved searches are useful if you want to quickly view sessions or errors that relate to a certain population of your users.
To save a search, click the Save button below the search bar.
Session-specific searching
When you search on the Sessions page, the following behaviors apply by default:
- The Sessions page displays completed sessions that have been fully processed. This is equivalent to searching by
completed=true
. You can usecompleted=false
to find live sessions and sessions that are not yet fully processed. - The key is assumed to include the end user’s identifier and location. This could be the end user’s
email
,device_id
, or givenidentifier
, as well as theircity
orcountry
. For example, if you enter an expression without a key, such assearch-term
, then LaunchDarkly automatically expands that toemail=*search-term* OR city=*search-term*
.
Additionally, by default, the session replay SDK plugin automatically injects several attributes, to provide additional help with searching for sessions. To learn more, read Session replay.
Search by end user clicks
When you search on the Sessions page, you can search for sessions where an end user clicked a certain HTML element:
clickSelector
looks at the HTML element’s target’s selector, concatenating the element’stag
,id
, andclass
values.clickTextContent
looks at the HTML element’s target’stextContent
property. Only the first 2000 characters are considered.
Here is an example:
Search by visited URL
When you search on the Sessions page, you can search for sessions where an end user visited a particular URL, using the visited-url
filter. Use quotations around the value for this search to avoid any errors due to special characters in the the URL.
Here’s how:
As with other filters, you can use contains and matches regex expressions with visited-url
. The following example retrieves all sessions where the end user visited the “sessions” page:
Configure error views
You can configure the Errors page to display different subsets of errors. Use the date dropdown to select a time range, and search in the search bar to filter the errors.