Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

Tip

You don't need to transform your search window queries if you use the My last search queries and My favorite search queries boxes in the Data menu of the Activeboards area. They will be automatically transformed into the required format and will be added as aggregation tasks when required.

Aggregation operations

...

Addition, sum, plus / Concatenation (add, +) operations

When you use this operation in the Data Search to create a new field, you can add as many arguments as needed (where applicable), however, the number of arguments is limited to two when used in Activeboards.

As a workaround, you can perform subsequent maximum adding operations until you have obtained the maximum of added all the arguments you need.

Search window

Activeboards

Syntax:

Create field: select

max

add(value1, value2, value3, value4...) as

maxField

totalField

Query example:

Code Block
from demo.ecommerce.data
select 
max
add(bytesTransferred, timeTaken, statusCode) as 
`maxField`
`totalField`

Syntax:

Create field: select

max

add(value1, value2) as

maxFieldA

totalFieldA,

max

add(

maxFieldA

totalFieldA, value3) as

maxFieldB

totalFieldB,

max

add(

maxFieldB

totalFieldB, value4) as

maxFieldC

totalFieldC...

Query example:

Code Block
query(from demo.ecommerce.data
select 
max
add(bytesTransferred, timeTaken) as 
maxFieldA
totalFieldA, 
max
add(
maxFieldA
totalFieldA, statusCode) as 
maxFieldTotal
totalFieldFinal)

Related articles: Maximum (max)

...

Addition, sum, plus / Concatenation (add, +)

Comparison operations

Operations inside the detection group that imply comparing elements (such as equal, greater than, less than, etc.) are slightly adjusted in queries used from the search window to Activeboards or vice versa. On a general basis, both constructions work fine in both areas but each area has one of them as the default. This can create confusion because of the automatic transformations that are carried out in several processes when bringing queries from one place to the other. Here you have the preferred syntax for each of them, both to filter and create field:

Search window

Activeboards

Syntax:

Create field: select field operator "value"/field as fieldName
Filter: where field operator "value"/field 

Query example:

Code Block
from demo.ecommerce.data
where method = "POST"select timeTaken >= bytesTransferred

Syntax:

Create field: select operator (field, "value"/field) as fieldName
Filter: where operator(field, "value"/field)

Query example:

Code Block
query(from demo.ecommerce.data
where eq(method, "POST")select ge(timeTaken, bytesTransferred))

Related articles: Detection group

Maximum (max) operations → create field

When you use this operation in the Data Search to create a new field, you can add as many arguments as needed, however, the number of arguments is limited to two when used in Activeboards.

As a workaround, you can perform subsequent minimum maximum operations until you have obtained the minimum maximum of all the arguments you need.

Search window

Activeboards

Syntax:

Create field: select

min

max(value1, value2, value3, value4...) as

minField

maxField

Query example:

Code Block
from demo.ecommerce.data
select 
min
max(bytesTransferred, timeTaken, statusCode) as 
`minField`
`maxField`

Syntax:

Create field: select

min

max(value1, value2) as

minFieldA

maxFieldA,

min

max(

minFieldA

maxFieldA, value3) as

minFieldB

maxFieldB,

min

max(

minFieldB

maxFieldB, value4) as

minFieldC

maxFieldC...

Query example:

Code Block
query(from demo.ecommerce.data
select 
min
max(bytesTransferred, timeTaken) as 
minFieldA
maxFieldA, 
min
max(
minFieldA
maxFieldA, statusCode) as 
minFieldTotal
maxFieldTotal)

Related articles: Minimum Maximum (minmax)

Arithmetic operations

...

Minimum (min) operations → create field

When you use this operation in the Data Search to create a new field, you can add as many arguments as needed (where applicable), however, the number of arguments is limited to two when used in Activeboards.

As a workaround, you can perform subsequent adding minimum operations until you have added obtained the minimum of all the arguments you need.

Search window

Activeboards

Syntax:

Create field: select

add

min(value1, value2, value3, value4...) as

totalField

minField

Query example:

Code Block
from demo.ecommerce.data
select 
add
min(bytesTransferred, timeTaken, statusCode) as 
`totalField`
`minField`

Syntax:

Create field: select

add

min(value1, value2) as

totalFieldA

minFieldA,

add

min(

totalFieldA

minFieldA, value3) as

totalFieldB

minFieldB,

add

min(

totalFieldB

minFieldB, value4) as

totalFieldC

minFieldC...

Query example:

Code Block
query(from demo.ecommerce.data
select 
add
min(bytesTransferred, timeTaken) as 
totalFieldA
minFieldA, 
add
min(
totalFieldA
minFieldA, statusCode) as 
totalFieldFinal
minFieldTotal)

Related articles: Addition, sum, plus / Concatenation (add, +Minimum (min)

Multiplication, product (mul, *) operations

When you use this operation in the Data Search, you can add as many arguments as needed, however, the number of arguments is limited to two when used in Activeboards.

As a workaround, you can perform subsequent multiplication operations until you have multiplied all the arguments you need.

Search window

Activeboards

Syntax:

Create field: select mul(value1, value2, value3, value4...) as resultField

Query example:

Code Block
from demo.ecommerce.data
select mul(bytesTransferred, timeTaken, statusCode) as `resultField`

Syntax:

Create field: select mul(value1, value2) as resultFieldA, mul(resultFieldA, value3) as resultFieldB, mul(resultFieldB, value4) as resultFieldC...

Query example:

Code Block
query(from demo.ecommerce.data
select mul(bytesTransferred, timeTaken) as resultFieldA, mul(resultFieldA, statusCode) as resultFieldTotal)

Related articles: Multiplication, product (mul, *)

Array operation

When you have fields that contain sets of values as opposed to single values, this operation transforms its data type into an array to be later used to invoke one of the values inside the set. This operation can be used both to create field and as a filter. When used to create a field, the value invoked will be inserted in the new field while as a filter it will be used as filtering criteria.

This operation is not supported in the search window so you will not be able to bring queries from one are to the other. To use this operation outside Activeboards, you need to use the query API.

...

Search window

...

Activeboards

...

Not supported

Syntax:

Create field: select array(field) [valuePosition] as fieldName
Filter: where field operator array(field) [valuePosition]

Query example:

...

)

...

Related articles: Query API

Collect distinct operation

This operation will return the set of distinct values for the specified field when grouping events. This operation is not supported in the search window so you need to be careful when using queries from one area to the other. If you want to use it outside Activeboards you can do so with the query API.

...

Search window

...

Activeboards

...

Not supported

...

Syntax:

select collectdistinct(field) as fieldName

Query Example:

Code Block
query (from demo.ecommerce.data
group every 5m by method, statusCodeselect
collectdistinct(bytesTransferred) as distinctBytesTransferred)

Related articles: Query API

Global syntax

Whilst you don't have to add anything in search window queries, Activeboard queries must be enclosed between brackets, with the word "query" added before. Queries from the search window will be automatically transformed when used in Activeboards, however, trying to use an Activeboard query in the search window will return an error.

...

Search window

...

Activeboards

...

Syntax:

from tag1.tag2.tag3.tag4

Query example:

Code Block
from demo.ecommerce.data

...

Syntax:

query(from tag1.tag2.tag3.tag4)

Query example:

Code Block
query(from demo.ecommerce.data)

Lookup operations

Queries to use lookup operations present some particularities that make them incompatible when used from the search window to Activeboards or vice versa. The use of symbols is different and the domain name is required in one of them.

Search window

Activeboards

Syntax:

select `lu/lookupName/lookupfield`(field) as newfieldName


Query example:

Code Block
from demo.ecommerce.data
select `lu/IP_list/StreetAddress`(clientIpAddress) as `IP street address`

Syntax:

select lu("lookupName", "lookupfield", field) as newfieldName

Query example:

Code Block
query(from demo.ecommerce.data
select lu("IP_list", "StreetAddress", clientIpAddress) as `IP street address`)

Related article: Data enrichment

...

Mlevalmodel operation is not supported in search window. Use this operation in Activeboards when you want to work with models you uploaded in Model Management.

Search window

Activeboards

Not supported

Query examples:

Code Block
from "datatable"
select "fields"
mlevalmodel("domain", "ModelName", "ModelFields") as "NameNewField"

Example:

Code Block
from demo.ecommerce.data
select 
  split(referralUri, "/",2) as domain,
  float(lenght(domain)) as lenght
  shannonentropy(domain) as entropy
  float(countbyfilter(domain, "aeiuoAEIOU")) as p_vowels,
  mlevamodel("self", "example_test", lenght, entropy, p_vowels) as prob
  ifthenelse(prob>0.8, "dga", "legit") as type 

Refer article: Model Management

Order operations

Order operations are slightly adjusted in queries used from the search window to Activeboards or vice versa. On a general basis, both constructions work fine in both areas but each area has one of them as the default. This can create confusion because of the automatic transformations that are carried out in several processes when bringing queries from one place to the other. Here you have the preferred syntax for each of them, both to filter and create field:

...

Search window

...

Activeboards

Syntax:

Create field: select field operator "value"/field as fieldName
Filter: where field operator "value"/field 

...

Code Block
from demo.ecommerce.data
where method = "POST"select timeTaken >= bytesTransferred

...

Syntax:

Create field: select operator (field, "value"/field) as fieldName
Filter: where operator(field, "value"/field)

Query example:

Code Block
query(from demo.ecommerce.data
where eq(method, "POST")select ge(timeTaken, bytesTransferred))

Related articles: Order group

Subqueries

Subqueries are not supported in the search window yet so you need to be careful when using queries from one area to the other because you will not be able to reproduce subqueries. If you want to use subqueries out of Activeboards, your only option so far is to use the query API.

...

Search window

...

Activeboards

...

Not supported

...

Syntax:

Create field: select (from tag1.tag2.tag3.tag4) as fieldName
Filter: where field in (from tag1.tag2.tag3.tag4) 

Query example:

Code Block
query(from siem.logtrust.web.activity
select ((
from siem.logtrust.web.navigation
group every - by userEmail
select count()) as inner)
select inner[username] as nav
group by username, nav)
Code Block
query (from demo.ecommerce.data
where statusCode in
(from demo.ecommerce.data
where statusCode = "404"
where now()- 5m < eventdate < now()
group every - by statusCode)
select method, statusCode, eventdate)

Related articles: SubqueriesQuery API