Filtering on logs
The fields the Logs filter bar accepts, how body search works, and worked examples for everyday log filtering.
This page is for anyone who searches logs in the Log Explorer. It lists the log fields and task examples you can copy. The language rules are in the filter quick reference.
Fields
The last column gives the column name that SPL and SQL use, where it differs. A field not in the list is an error, and the bar suggests the closest names.
| Field | Type | Takes | SQL column |
|---|---|---|---|
workload | string | value, OR list, * ?, ~ | Same |
service | string | value, OR list, * ?, ~ | Same |
namespace | string | value, OR list, * ?, ~ | Same |
domain | string | value, OR list, * ?, ~ | cluster |
instance | string | value, OR list, * ?, ~ | pod_name |
container | string | value, OR list, * ?, ~ | container_name |
node | string | value, OR list, * ?, ~ | host |
type | string | value, OR list, * ?, ~ | level |
format | string | value, OR list, * ?, ~ | Same |
source | string | value, OR list, * ?, ~ | Same |
region | string | value, OR list, * ?, ~ | Same |
app_version | string | value, OR list, * ?, ~ | Same |
env_type | string | value, OR list, * ?, ~ | Same |
body | string | word, phrase, part of a line, OR or AND list | Same |
Notes on the fields:
typeis the log level, with values such asERROR,WARN,INFOandDEBUG.domainis the cluster, andinstanceis the pod. The filter bar refuses the old namespod_nameandcluster.- Every field except
bodyis text, with exact, case-sensitive matching. Logs have no numeric field. Use an attribute for a number.
The full list with example values is in Log and trace fields.
Body and attributes
body is the log message. body:timeout matches the whole word, and a word on its own, timeout, means the same. The bar suggests no values after body:, because log lines make poor suggestions and finding them is slow. You get your recent searches instead. The rules are in Searching the log body and Words without a field.
Attributes start with @, as in @http.status_code>=500. See Attributes. On logs, -@key:value matches rows that have the key with a different value, not rows that lack the key. To match inside a list, write @tags[*]:prod. See Lists in a log.
Examples
Body search examples are in the quick reference.
| Task | Filter | What it matches |
|---|---|---|
| Errors from checkout | workload:checkout type:ERROR | Lines from the checkout workload at level ERROR. |
| Errors and warnings in one namespace | namespace:prod type:(ERROR OR WARN) | Lines in prod at either level. |
| Everything except debug noise | namespace:prod -type:(DEBUG OR TRACE) | Lines in prod that are not at those two levels. |
| Exclude health checks | workload:checkout -body:(healthz OR readyz) | checkout lines that mention neither word. |
| All pods of one workload | instance:checkout-* type:ERROR | Errors from pods whose name starts with checkout-. |
| One node | node:ip-10-0-1-* type:ERROR | Errors from nodes whose name starts with ip-10-0-1-. |
| One cluster | domain:prod-eu type:ERROR | Errors from the cluster named prod-eu. |
| Server errors from an attribute | @http.status_code>=500 | Lines whose http.status_code attribute is 500 or more. |
| One user | @user.id:u-1042 type:ERROR | Errors that carry that user.id. |
| Lines that carry a request id | workload:checkout @request_id:* | checkout lines that have a request_id attribute. |
With a word on its own:
| Task | Filter | What it matches |
|---|---|---|
| A phrase in one workload | workload:checkout "payment failed" | checkout lines that contain payment failed. |
See Filtering on each screen for the other screens that take log filters.