search
This command is experimental |
Definition
search
retrieves data from one or more datasets. You can use keywords, wildcards, quoted phrases and expressions to get results from a dataset.
Examples
The simplest way to do a search is to define with index
from which dataset to retrieve data. The part of command in parentheses is optional.
%dpl
(| search) index=example
At the moment, if the |
You can use wildcards to search from multiple datasets at the same time. However, we don’t recommend doing index=*
search since it’s prone to slow down the performance with big data masses.
index=join* earliest=2021-01-01T00:00:00.000+03:00
Keywords
You can add one or more keywords in your search. The keyword or keywords will only search from _raw table column.
%dpl
index=join_json_one earliest=2021-01-01T00:00:00.000+03:00 18 Alice
%dpl
index=join_json_one earliest=2021-01-01T00:00:00.000+03:00
| search 18 Alice
To make a literal search, add quotation marks around the keyword.
%dpl
index=example earliest=2020-01-01T00:00:00.000+03:00 "38.42"
%dpl
index=example earliest=2020-01-01T00:00:00.000+03:00
| search "38.42"
Searching from Table Columns
To search results from other table columns than _raw, use <column-name>=<keyword>
.
%dpl
index=join* earliest=2021-01-01T00:00:00.000+03:00 offset=1
%dpl
index=join_json_one earliest=2021-01-01T00:00:00.000+03:00
| search offset=1
Earliest and Latest
At the moment, if the |
You can set a date range for your search by using either earliest
, latest
or both. The default time format is ISO 8601.
index=example earliest=2021-01-01T00:00:00.000+03:00 latest=2021-12-31T23:59:00.000+03:00
In search command, |
Less-Than and Greater-Than Comparisons
You can search results that are less or greater than defined value.
%dpl
index=join_json_one earliest=2021-01-01T00:00:00.000+03:00
| spath
| search count<30
Currently, less-than and greater-than comparisons don’t work in Teragrep. This will be fixed before the community release. |
OR and AND
By using OR
, you can return results that matches with either criteria.
%dpl
index=join_json_one earliest=2021-01-01T00:00:00.000+03:00
| spath
| search user=Carlos OR user=Bob
By using AND
, you can return results that matches with both criteria.
%dpl
index=join_json_one earliest=2021-01-01T00:00:00.000+03:00
| spath
| search user=Carlos AND target=Bob