Table of Contents |
---|
maxLevel | 2 |
---|
minLevel | 1 |
---|
type | flat |
---|
|
...
Endpoints and methods
POST /query
Use this endpoint tu run a query through the API.
Rw ui expands macro |
---|
Request bodyThe request JSON body must include an object with the following key-value pairs. Parameter | Type | Description |
---|
query
| string
| This is the query that you want to run, expressed in LINQ. To find the query's LINQ script in the Devo app, open the query in the Data search area, then choose Query code editor from the toolbar. The body of the request must contain either the query or the queryId parameter. | queryId
| string
| This is the ID of the query that you want to run. To find the query ID, open the query in the Data search area, then open the search window menu and select Current query → Get ID. The body of the request must contain either the query or the queryId parameter. | from required
| integer
| The start date as a UTC timestamp in seconds. See the Relative dates section below to learn more about this parameter. | to
| integer
| The end date as a UTC timestamp in seconds. If this parameter is left out, the query will be continuous. See the Relative dates section below to learn more about this parameter. | mode
| object
| This object contains the type parameter (string ) to specify the format of the response. If left out of the request body, the default response type json will be used. The possible values are: json
json/compact
json/simple
json/simple/compact
msgpack
csv
tsv
xls
These response formats are fully described later in this article. When you indicate a response format other than json , you must include the dateFormat and timeZone parameters. | destination
| object
| This object specifies where the response should be sent. If this object is left out of the request body, the response will be sent back to the request source. It must include the following parameters: Depending on the type , additional parameters will be required. See the related HDFS, S3, email, SNMP and Kafka articles. params - (string ) Destination parameters, depend on the type selected. Check the HDFS, Kafka, S3, email and SNMP articles to see the parameters required for each destination.
| dateFormat
| string
| This is only required when you specify a type other than json . The possible formats are: default - yyyy-MM-dd' 'HH:mm:ss.SSS
sql - yyyy-MM-dd' 'HH:mm:ss.SSS
iso - yyyy-MM-dd'T'HH:mm:ss.SSSXX
| timeZone
| string
| Change the timezone of the query, only for mode types other than json . This parameter supports any positive or negative GMT timezones, like GMT-2 or GMT+1 | timeUnit
| string
| When from or to params are timestamps, you can use this parameter to specify the time unit. Only MILLISECONDS or SECONDS are valid values. | skip /offset
| integer
| You can use either the skip or offset parameters to skip the first X elements of the query. | limit
| integer
| Limit the results of the query. The query will stop after returning the first X elements of the query or reaching its end. | ipAsString
| boolean
| Set this parameter to true if you want to get IP addresses as dotted strings (for example, 94.2.23.1 ). If you don't add this parameter in your request or set it to false , IP addresses will be returned as numbers (for example, 1577195265 ). | vaultName
| string
| Query priority. Allowed values are: | progressInfo
| boolean
| Set this parameter to true if you want to get progress info about the requested query. You will get an entry p with the timestamp of the event that is being processed at that moment. Progress info will be sent at most once every 5s. This is only available if you set type as json/simple/compact . See an example below. | allowPartialResults
| boolean
| Specifies whether partial results are allowed or not (true by default). If partial results are not allowed, the query will be interrupted every time some results are missing due to a failure. | keepAlive
| object
| Object with information about the keep alive message for CSV, TSV and XLS modes. If not provided, live queries aren't accepted for the mentioned modes. Note that this object doesn't apply to any json mode. This object must contain the following parameters: Examples: Code Block |
---|
"keepAlive": {
"type":"empty"
} |
Code Block |
---|
"keepAlive": {
"type":"token",
"token":"myToken"
} |
| timeRangeFilter
| object
| Add this object to use time control in your query. Time control allows you to choose either the event date (time when Devo receives the data) or creation date (time when the events are generated in its source) as reference time when you query data. Check this article to learn more about time control and how to use it in the Devo app. This object may include the following parameters: by - (string ) Choose the reference time to be used in your query. Allowed values are eventdate and creationdate . Default value is eventdate .
allowedLateness - (string ) This option can only be used if you enter creationdate in the by parameter above. Enter the maximum expected delay between the creation date and the ingestion date of the table queried. It admits duration type expressions (1h , 1d , etc). Default value is now .
Info |
---|
Setting a reception delay using the allowedLateness parameter allows the system to increase performance as it only looks for the corresponding events. |
|
Example Code Block |
---|
curl --location 'https://apiv2-us.devo.com/search/query' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 2e672c8182f67a3bc6cd7a6815864589' \
--data '{
"query": "from siem.logtrust.web.activity",
"limit": 30,
"from": "1s",
"keepAlive": {
"type":"empty"
}
}' |
The following are examples of responses: Code Block |
---|
{
"query": "from demo.ecommerce.data select *",
"from": 1519645036,
"to": 1519645136,
"mode": {
"type": "json"
},
"destination": {
"type": "hdfs",
"params": {
"param1": "value1",
"param1": "value2"
}
}
} |
Code Block |
---|
{
"from": 1519989362,
"mode": {
"type": "json/simple"
},
"query": "from my.synthesis.vec00.suricataalert group every 30s every 30s select *",
"to": 1519989392
} |
Code Block |
---|
{
"query": "from demo.ecommerce.data select *",
"limit": 10,
"from": 1528306922,
"to": 1528306952,
"mode": {
"type": "tsv"
}
} |
|
...
Time expression | Description | Resulting time |
---|
now() - 60m | 60 minutes ago | Sunday, 05 February 2017, 12:37:05 |
now() @ 1h | Now (rounded to the beginning of the hour) | Sunday, 05 February 2017, 13:00:00 |
now() - 24h | 24 hours ago | Saturday, 04 February 2017, 13:37:05 |
(now() - 1d) @ 1d | Yesterday (rounded to the beginning of the day) | Saturday, 04 February 2017, 00:00:00 |
(now() - 2d) @ 1d | 2 days ago (rounded to the beginning of the day) | Friday, 03 February 2017, 00:00:00 |
(now() - 2d) @ 1m | 2 days ago (rounded to the beginning of the minute) | Friday, 03 February 2017, 13:37:00 |
((now() - 2d) @ 1d) - 2h | 2 days ago (rounded to the beginning of the day minus 2 hours) | Thursday, 02 February 2017, 22:00:00 |
now() @ 1w | Locale week | Sunday, 05 February 2017, 00:00:00 |
now() @ 1W | ISO week | Monday, 30 January 2017, 00:00:00 |
now() ^ 6d | Replace the day with 6 | Monday, 06 February 2017, 13:37:05 |
now() ^ 2018y3M6d15h30m20s | | Tuesday, 06 March 2018, 15:30:20 |
Relatives dates
...
Anchor |
---|
| queryresponseformats |
---|
| queryresponseformats |
---|
|
Responses to your queries can be either returned to the source of the request, forwarded to an HDFS, S3, SNMP, or Kafka type system, or sent via email.
...