Write your first DataPrime query in Coralogix
Build a DataPrime query to filter and count events, checking fields, time scope and interpretation limits.
What you will create
Build a first DataPrime query to filter logs and count matching events. Learn to distinguish the source, time window and field being queried: three choices that can change the result without producing a syntax error.
Before you start
Use only a Coralogix workspace you are authorized to read, with test data already available. Do not upload production logs for this exercise. Check account limits and select a relevant short time window. Field names below are assumptions to adapt to the actual schema.
Step-by-step
- Define the question. For example: how many events contain the numeric HTTP status 500 within the selected period? This does not mean “how many distinct incidents”.
- Identify source and time. In DataPrime exploration, start with
source logs. Check that the events you need exist in the selected period and dataset. - Inspect an event. Identify the field's path and type.
$dmeans event data,$mmetadata and$llabels. A data field called severity is not automatically Coralogix's normalized severity. - Filter before counting. Add a filter for the actual field and inspect a few matching events. Do not copy a path that does not exist in your data.
- Add the count. Once the filter is understood, append
| count. Each step receives the previous step's output. Do not put a sampling limit before the count if you want the total number of matching events. - Record scope. Keep the query, time window and assumptions with the result. A number without this context is difficult to explain or compare.
Example to adapt
Assume three fictional events in the same period with numeric http.status_code fields of 200, 500 and 500. Under this assumption, the following query should count two events:
source logs
| filter $d.http.status_code == 500
| countThis illustrative dataset was not ingested. If the field is a string, adapt the comparison to its type. For a different question about normalized severity, the documented syntax is:
source logs
| filter $m.severity == ERROR
| countThese queries are not equivalent: HTTP status and severity describe different properties.
Check your result
- Inspected events really satisfy the filter.
- The field type matches the compared value.
- Source and time window are identical between compared runs.
- Your report counts events without inventing a count of users or incidents.
Common problems
No results: check time, source, path, type and read permissions before concluding there were no errors. A different result elsewhere: compare filters and time windows. A surprisingly low count: look for a limit before counting or a severity field in the wrong namespace. An AI-suggested query: review it like any other query rather than assuming it is valid.
Next steps
See the Coralogix overview, then add one transformation at a time. This guide is based on documentation: no account connection, ingestion or query execution was performed.


