# Can we get events related to specific check in sensu-go?

**URL:** <https://discourse.sensu.io/t/can-we-get-events-related-to-specific-check-in-sensu-go/2644>\
**Category:** Sensu Go\
**Tags:** sensu-go, backend\
**Created:** [July 14, 2021, 9:58am UTC](https://discourse.sensu.io/t/can-we-get-events-related-to-specific-check-in-sensu-go/2644 "2021-07-14T09:58:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siva\_Sukumar\_Reddy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/siva_sukumar_reddy/32/635_2.png) [@Siva\_Sukumar\_Reddy](https://discourse.sensu.io/u/Siva_Sukumar_Reddy)\
**Post date:** [July 14, 2021, 9:58am UTC](https://discourse.sensu.io/t/can-we-get-events-related-to-specific-check-in-sensu-go/2644/1 "2021-07-14T09:58:21Z")

</div>

I was trying to get events related to a specific sensu check using curl i.e., all the events related to specific sensu check on all entities.  
But as per the documentation, it seems like there is no way to do so. But, I found a way to get for specific entity and check but not for a check alone.  
Please help me how to get events related to specific check.

---

<div class="post-metadata">

**Author:** ![jspaleta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/jspaleta/32/141_2.png) [@jspaleta](https://discourse.sensu.io/u/jspaleta)\
**Post date:** [July 14, 2021, 7:05pm UTC](https://discourse.sensu.io/t/can-we-get-events-related-to-specific-check-in-sensu-go/2644/2 "2021-07-14T19:05:53Z")

</div>

Hey,

I believe you can use the field selector commercial feature with curl when using the official sensu-backend binaries to get the behavior you want by filtering on the field ‘event.check.name’.

Here’s an example using an Sensu API key that will give me all events matching the check name ‘keepalive’

```bash
curl -H "Authorization: Key $SENSU_API_KEY" https://127.0.0.1:8080/api/core/v2/events -G --data-urlencode 'fieldSelector=event.check.name == "keepalive"'

```

You can combine field selector expressions, for example I can get all keepalive events outside of default namespace thusly:

```bash
curl -H "Authorization: Key $SENSU_API_KEY" https://127.0.0.1:8080/api/core/v2/events -G --data-urlencode 'fieldSelector=event.check.name == "keepalive && event.namespace != "default""'

```

Field selectors are covered here:  
[https://docs.sensu.io/sensu-go/latest/api/#field-selector](https://docs.sensu.io/sensu-go/latest/api/#field-selector)

---

<div class="post-metadata">

**Author:** ![JonG](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@JonG](https://discourse.sensu.io/u/JonG)\
**Post date:** [July 20, 2021, 5:17pm UTC](https://discourse.sensu.io/t/can-we-get-events-related-to-specific-check-in-sensu-go/2644/3 "2021-07-20T17:17:02Z")

</div>

With selectors, you should be able to do some good selections.

As a note, last time I drilled into this the selector is a string match. This means you can’t filter based on integer comparisons (e.g. “event.check.status \>= 1” to be either in warning or in critical – so you’ll need to use inequalities, ‘notin’ to form some of your queries).

We have a similar use case where we an external systemd wanted to see if a particular check was failing and not silenced. Similar to Jef’s examples above.

```auto
curl -sS -G \
  -H "Authorization: Key $SENSU_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  https://127.0.0.1:8080/api/core/v2/namespaces/default/events --data-urlencode 'fieldSelector=event.check.status == "2" && event.is_silenced == "false" && event.check.name == "prod-tax-heartbeat-alert"'

```

---

<div class="post-metadata">

**Author:** ![yuvsaha123](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/yuvsaha123/32/711_2.png) [@yuvsaha123](https://discourse.sensu.io/u/yuvsaha123)\
**Post date:** [February 6, 2022, 11:45am UTC](https://discourse.sensu.io/t/can-we-get-events-related-to-specific-check-in-sensu-go/2644/4 "2022-02-06T11:45:05Z")

</div>

thanks my issue has been fixed.
