The Event Management API allows you to programmatically post events to the Events Explorer
and fetch events from the Events Explorer. See the Event Management page for more information.
The event stream can be queried and filtered by time, priority, sources and tags.
Notes:
If the event you’re querying contains markdown formatting of any kind,
you may see characters such as %,\,n in your output.
This endpoint returns a maximum of 1000 most recent results. To return additional results,
identify the last timestamp of the last result and set that as the end query time to
paginate the results. You can also use the page parameter to specify which set of 1000 results to return.
This endpoint requires the events_read permission.
OAuth apps require the events_read authorization scope to access this endpoint.
Arguments
Query Strings
Name
Type
Description
start [required]
integer
POSIX timestamp.
end [required]
integer
POSIX timestamp.
priority
enum
Priority of your events, either low or normal. Allowed enum values: normal, low
sources
string
A comma separated string of sources.
tags
string
A comma separated list indicating what tags, if any, should be used to filter the list of events.
unaggregated
boolean
Set unaggregated to true to return all events within the specified [start,end] timeframe.
Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe,
it won’t be available in the output. Aggregated events with is_aggregate=true in the response will still be returned unless exclude_aggregate is set to true.
exclude_aggregate
boolean
Set exclude_aggregate to true to only return unaggregated events where is_aggregate=false in the response. If the exclude_aggregate parameter is set to true,
then the unaggregated parameter is ignored and will be true by default.
page
integer
By default 1000 results are returned per request. Set page to the number of the page to return with 0 being the first page. The page parameter can only be used
when either unaggregated or exclude_aggregate is set to true.
If an alert event is enabled, set its type.
For example, error, warning, info, success, user_update,
recommendation, and snapshot.
Allowed enum values: error,warning,info,success,user_update,recommendation,snapshot
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (that is no quotes).
Limited to events up to 18 hours in the past and two hours in the future.
device_name
string
A device name.
host
string
Host name to associate with the event.
Any tags associated with the host are also applied to this event.
id
int64
Integer ID of the event.
id_str
string
Handling IDs as large 64-bit numbers can cause loss of accuracy issues with some programming languages.
Instead, use the string representation of the Event ID to avoid losing accuracy.
payload
string
Payload of the event.
priority
enum
The priority of the event. For example, normal or low.
Allowed enum values: normal,low
source_type_name
string
The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc.
The list of standard source attribute values available here.
tags
[string]
A list of tags to apply to the event.
text
string
The body of the event. Limited to 4000 characters. The text supports markdown.
To use markdown in the event text, start the text block with %%% \n and end the text block with \n %%%.
Use msg_text with the Datadog Ruby library.
title
string
The event title.
url
string
URL of the event.
status
string
A status.
{"events":[{"alert_type":"info","date_happened":"integer","device_name":"string","host":"string","id":"integer","id_str":"string","payload":"{}","priority":"normal","source_type_name":"string","tags":["environment:test"],"text":"Oh boy!","title":"Did you hear the news today?","url":"string"}],"status":"string"}
"""
Get a list of events returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.events_apiimportEventsApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=EventsApi(api_client)response=api_instance.list_events(start=9223372036854775807,end=9223372036854775807,)print(response)
# Get a list of events returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::EventsAPI.newpapi_instance.list_events(9223372036854775807,9223372036854775807)
// Get a list of events returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewEventsApi(apiClient)resp,r,err:=api.ListEvents(ctx,9223372036854775807,9223372036854775807,*datadogV1.NewListEventsOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `EventsApi.ListEvents`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `EventsApi.ListEvents`:\n%s\n",responseContent)}
// Get a list of events returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.EventsApi;importcom.datadog.api.client.v1.model.EventListResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();EventsApiapiInstance=newEventsApi(defaultClient);try{EventListResponseresult=apiInstance.listEvents(9223372036854775807L,9223372036854775807L);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling EventsApi#listEvents");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a list of events returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_events::EventsAPI;usedatadog_api_client::datadogV1::api_events::ListEventsOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=EventsAPI::with_config(configuration);letresp=api.list_events(9223372036854775807,9223372036854775807,ListEventsOptionalParams::default(),).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get a list of events returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.EventsApi(configuration);constparams: v1.EventsApiListEventsRequest={start: 9223372036854775807,end: 9223372036854775807,};apiInstance.listEvents(params).then((data: v1.EventListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The response object with all events matching the request and pagination information.
Expand All
Field
Type
Description
data
[object]
An array of events matching the request.
attributes
object
The object description of an event response attribute.
attributes
object
Object description of attributes from your event.
aggregation_key
string
Aggregation key of the event.
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (no quotation marks).
Limited to events no older than 18 hours.
device_name
string
A device name.
duration
int64
The duration between the triggering of the event and its recovery in nanoseconds.
event_object
string
The event title.
evt
object
The metadata associated with a request.
id
string
Event ID.
name
string
The event name.
source_id
int64
Event source ID.
type
string
Event type.
hostname
string
Host name to associate with the event.
Any tags associated with the host are also applied to this event.
monitor
object
Attributes from the monitor that triggered the event.
created_at
int64
The POSIX timestamp of the monitor's creation in nanoseconds.
group_status
int32
Monitor group status used when there is no result_groups.
groups
[string]
Groups to which the monitor belongs.
id
int64
The monitor ID.
message
string
The monitor message.
modified
int64
The monitor's last-modified timestamp.
name
string
The monitor name.
query
string
The query that triggers the alert.
tags
[string]
A list of tags attached to the monitor.
templated_name
string
The templated name of the monitor before resolving any template variables.
type
string
The monitor type.
monitor_groups
[string]
List of groups referred to in the event.
monitor_id
int64
ID of the monitor that triggered the event. When an event isn't related to a monitor, this field is empty.
priority
enum
The priority of the event's monitor. For example, normal or low.
Allowed enum values: normal,low
related_event_id
int64
Related event ID.
service
string
Service that triggered the event.
source_type_name
string
The type of event being posted.
For example, nagios, hudson, jenkins, my_apps, chef, puppet, git or bitbucket.
The list of standard source attribute values is available here.
sourcecategory
string
Identifier for the source of the event, such as a monitor alert, an externally-submitted event, or an integration.
status
enum
If an alert event is enabled, its status is one of the following:
failure, error, warning, info, success, user_update,
recommendation, or snapshot.
Allowed enum values: failure,error,warning,info,success,user_update,recommendation,snapshot
tags
[string]
A list of tags to apply to the event.
timestamp
int64
POSIX timestamp of your event in milliseconds.
title
string
The event title.
message
string
The message of the event.
tags
[string]
An array of tags associated with the event.
timestamp
date-time
The timestamp of the event.
id
string
the unique ID of the event.
type
enum
Type of the event.
Allowed enum values: event
default: event
links
object
Links attributes.
next
string
Link for the next set of results. Note that the request can also be made using the
POST endpoint.
meta
object
The metadata associated with a request.
elapsed
int64
The time elapsed in milliseconds.
page
object
Pagination attributes.
after
string
The cursor to use to get the next results, if any. To make the next request, use the same
parameters with the addition of the page[cursor].
request_id
string
The identifier of the request.
status
string
The request status.
warnings
[object]
A list of warnings (non-fatal errors) encountered. Partial results might be returned if
warnings are present in the response.
code
string
A unique code for this type of warning.
detail
string
A detailed explanation of this specific warning.
title
string
A short human-readable summary of the warning.
{"data":[{"attributes":{"attributes":{"aggregation_key":"string","date_happened":"integer","device_name":"string","duration":"integer","event_object":"Did you hear the news today?","evt":{"id":"6509751066204996294","name":"string","source_id":36,"type":"error_tracking_alert"},"hostname":"string","monitor":{"created_at":1646318692000,"group_status":"integer","groups":[],"id":"integer","message":"string","modified":"integer","name":"string","query":"string","tags":["environment:test"],"templated_name":"string","type":"string"},"monitor_groups":[],"monitor_id":"integer","priority":"normal","related_event_id":"integer","service":"datadog-api","source_type_name":"string","sourcecategory":"string","status":"info","tags":["environment:test"],"timestamp":1652274265000,"title":"Oh boy!"},"message":"string","tags":["team:A"],"timestamp":"2019-01-02T09:42:36.320Z"},"id":"AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA","type":"event"}],"links":{"next":"https://app.datadoghq.com/api/v2/events?filter[query]=foo\u0026page[cursor]=eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="},"meta":{"elapsed":132,"page":{"after":"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="},"request_id":"MWlFUjVaWGZTTTZPYzM0VXp1OXU2d3xLSVpEMjZKQ0VKUTI0dEYtM3RSOFVR","status":"done","warnings":[{"code":"unknown_index","detail":"indexes: foo, bar","title":"One or several indexes are missing or invalid. Results hold data from the other indexes."}]}}
"""
Get a list of events returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.events_apiimportEventsApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=EventsApi(api_client)response=api_instance.list_events()print(response)
// Get a list of events returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewEventsApi(apiClient)resp,r,err:=api.ListEvents(ctx,*datadogV2.NewListEventsOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `EventsApi.ListEvents`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `EventsApi.ListEvents`:\n%s\n",responseContent)}
// Get a list of events returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.EventsApi;importcom.datadog.api.client.v2.model.EventsListResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();EventsApiapiInstance=newEventsApi(defaultClient);try{EventsListResponseresult=apiInstance.listEvents();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling EventsApi#listEvents");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a list of events returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_events::EventsAPI;usedatadog_api_client::datadogV2::api_events::ListEventsOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=EventsAPI::with_config(configuration);letresp=api.list_events(ListEventsOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get a list of events returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.EventsApi(configuration);apiInstance.listEvents().then((data: v2.EventsListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
An arbitrary string to use for aggregation. Limited to 100 characters.
If you specify a key, all events using that key are grouped together in the Event Stream.
alert_type
enum
If an alert event is enabled, set its type.
For example, error, warning, info, success, user_update,
recommendation, and snapshot.
Allowed enum values: error,warning,info,success,user_update,recommendation,snapshot
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (that is no quotes).
Limited to events no older than 18 hours
device_name
string
A device name.
host
string
Host name to associate with the event.
Any tags associated with the host are also applied to this event.
priority
enum
The priority of the event. For example, normal or low.
Allowed enum values: normal,low
related_event_id
int64
ID of the parent event. Must be sent as an integer (that is no quotes).
source_type_name
string
The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc.
A complete list of source attribute values available here.
tags
[string]
A list of tags to apply to the event.
text [required]
string
The body of the event. Limited to 4000 characters. The text supports markdown.
To use markdown in the event text, start the text block with %%% \n and end the text block with \n %%%.
Use msg_text with the Datadog Ruby library.
title [required]
string
The event title.
{"title":"Example-Event","text":"A text message.","tags":["test:ExampleEvent"]}
{"title":"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters","text":"A text message.","tags":["test:ExampleEvent"]}
If an alert event is enabled, set its type.
For example, error, warning, info, success, user_update,
recommendation, and snapshot.
Allowed enum values: error,warning,info,success,user_update,recommendation,snapshot
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (that is no quotes).
Limited to events up to 18 hours in the past and two hours in the future.
device_name
string
A device name.
host
string
Host name to associate with the event.
Any tags associated with the host are also applied to this event.
id
int64
Integer ID of the event.
id_str
string
Handling IDs as large 64-bit numbers can cause loss of accuracy issues with some programming languages.
Instead, use the string representation of the Event ID to avoid losing accuracy.
payload
string
Payload of the event.
priority
enum
The priority of the event. For example, normal or low.
Allowed enum values: normal,low
source_type_name
string
The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc.
The list of standard source attribute values available here.
tags
[string]
A list of tags to apply to the event.
text
string
The body of the event. Limited to 4000 characters. The text supports markdown.
To use markdown in the event text, start the text block with %%% \n and end the text block with \n %%%.
Use msg_text with the Datadog Ruby library.
title
string
The event title.
url
string
URL of the event.
status
string
A status.
{"event":{"alert_type":"info","date_happened":"integer","device_name":"string","host":"string","id":"integer","id_str":"string","payload":"{}","priority":"normal","source_type_name":"string","tags":["environment:test"],"text":"Oh boy!","title":"Did you hear the news today?","url":"string"},"status":"string"}
# Curl command curl-XPOST"https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/events" \
-H"Accept: application/json" \
-H"Content-Type: application/json" \
-H"DD-API-KEY: ${DD_API_KEY}" \
-d@-<<EOF{
"title": "Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters",
"text": "A text message.",
"tags": [
"test:ExampleEvent"
]
}EOF
// Post an event returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.EventCreateRequest{Title:"Example-Event",Text:"A text message.",Tags:[]string{"test:ExampleEvent",},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewEventsApi(apiClient)resp,r,err:=api.CreateEvent(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `EventsApi.CreateEvent`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `EventsApi.CreateEvent`:\n%s\n",responseContent)}
// Post an event with a long title returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.EventCreateRequest{Title:"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters",Text:"A text message.",Tags:[]string{"test:ExampleEvent",},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewEventsApi(apiClient)resp,r,err:=api.CreateEvent(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `EventsApi.CreateEvent`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `EventsApi.CreateEvent`:\n%s\n",responseContent)}
// Post an event returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.EventsApi;importcom.datadog.api.client.v1.model.EventCreateRequest;importcom.datadog.api.client.v1.model.EventCreateResponse;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();EventsApiapiInstance=newEventsApi(defaultClient);EventCreateRequestbody=newEventCreateRequest().title("Example-Event").text("A text message.").tags(Collections.singletonList("test:ExampleEvent"));try{EventCreateResponseresult=apiInstance.createEvent(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling EventsApi#createEvent");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Post an event with a long title returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.EventsApi;importcom.datadog.api.client.v1.model.EventCreateRequest;importcom.datadog.api.client.v1.model.EventCreateResponse;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();EventsApiapiInstance=newEventsApi(defaultClient);EventCreateRequestbody=newEventCreateRequest().title("Example-Event very very very looooooooong looooooooooooong"+" loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+"+" characters").text("A text message.").tags(Collections.singletonList("test:ExampleEvent"));try{EventCreateResponseresult=apiInstance.createEvent(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling EventsApi#createEvent");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apioptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)title="Something big happened!"text='And let me tell you all about it here!'tags=['version:1','application:web']api.Event.create(title=title,text=text,tags=tags)# If you are programmatically adding a comment to this new event# you might want to insert a pause of .5 - 1 second to allow the# event to be available.
"""
Post an event returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.events_apiimportEventsApifromdatadog_api_client.v1.model.event_create_requestimportEventCreateRequestbody=EventCreateRequest(title="Example-Event",text="A text message.",tags=["test:ExampleEvent",],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=EventsApi(api_client)response=api_instance.create_event(body=body)print(response)
"""
Post an event with a long title returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.events_apiimportEventsApifromdatadog_api_client.v1.model.event_create_requestimportEventCreateRequestbody=EventCreateRequest(title="Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters",text="A text message.",tags=["test:ExampleEvent",],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=EventsApi(api_client)response=api_instance.create_event(body=body)print(response)
require'rubygems'require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# submitting events doesn 't require an application_key,# so we don't bother setting itdog=Dogapi::Client.new(api_key)dog.emit_event(Dogapi::Event.new('msg_text',:msg_title=>'Title'))# If you are programmatically adding a comment to this new event# you might want to insert a pause of.5 - 1 second to allow the# event to be available.
# Post an event returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::EventsAPI.newbody=DatadogAPIClient::V1::EventCreateRequest.new({title:"Example-Event",text:"A text message.",tags:["test:ExampleEvent",],})papi_instance.create_event(body)
# Post an event with a long title returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::EventsAPI.newbody=DatadogAPIClient::V1::EventCreateRequest.new({title:"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters",text:"A text message.",tags:["test:ExampleEvent",],})papi_instance.create_event(body)
// Post an event returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_events::EventsAPI;usedatadog_api_client::datadogV1::model::EventCreateRequest;#[tokio::main]asyncfnmain(){letbody=EventCreateRequest::new("A text message.".to_string(),"Example-Event".to_string()).tags(vec!["test:ExampleEvent".to_string()]);letconfiguration=datadog::Configuration::new();letapi=EventsAPI::with_config(configuration);letresp=api.create_event(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
// Post an event with a long title returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_events::EventsAPI;usedatadog_api_client::datadogV1::model::EventCreateRequest;#[tokio::main]asyncfnmain(){letbody=EventCreateRequest::new("A text message.".to_string(),"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters".to_string(),).tags(vec!["test:ExampleEvent".to_string()]);letconfiguration=datadog::Configuration::new();letapi=EventsAPI::with_config(configuration);letresp=api.create_event(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"cargo run
/**
* Post an event returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.EventsApi(configuration);constparams: v1.EventsApiCreateEventRequest={body:{title:"Example-Event",text:"A text message.",tags:["test:ExampleEvent"],},};apiInstance.createEvent(params).then((data: v1.EventCreateResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
/**
* Post an event with a long title returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.EventsApi(configuration);constparams: v1.EventsApiCreateEventRequest={body:{title:"Example-Event very very very looooooooong looooooooooooong loooooooooooooooooooooong looooooooooooooooooooooooooong title with 100+ characters",text:"A text message.",tags:["test:ExampleEvent"],},};apiInstance.createEvent(params).then((data: v1.EventCreateResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
A list of resources impacted by this change. It is recommended to provide an impacted resource to display
the change event at the right location. Only resources of type service are supported.
name [required]
string
Resource's name.
type [required]
enum
Resource's type.
Allowed enum values: service
new_value
object
Free form object to track new value of the changed resource.
prev_value
object
Free form object to track previous value of the changed resource.
category [required]
enum
Event category to identify the type of event. Only the value change is supported. Support for other categories are coming. please reach out to datadog support if you're interested.
Allowed enum values: change
message
string
The body of the event. Limited to 4000 characters.
tags
[string]
A list of tags to apply to the event.
Refer to Tags docs.
timestamp
string
Timestamp when the event occurred. Must follow ISO 8601 format.
For example "2017-01-15T01:30:15.010000Z".
Defaults to the timestamp of receipt. Limited to values no older than 18 hours.
title [required]
string
The event title. Limited to 500 characters.
type
enum
Entity type.
Allowed enum values: event
{"data":{"attributes":{"aggregation_key":"string","attributes":{"author":{"name":"datadog@datadog.com","type":"user"},"change_metadata":{"dd":{"team":"datadog_team","user_email":"datadog@datadog.com","user_id":"datadog_user_id","user_name":"datadog_username"},"resource_link":"datadog.com/feature/fallback_payments_test"},"changed_resource":{"name":"fallback_payments_test","type":"feature_flag"},"impacted_resources":[{"name":"payments_api","type":"service"}],"new_value":{"enabled":true,"percentage":"50%","rule":{"datacenter":"devcycle.us1.prod"}},"prev_value":{"enabled":true,"percentage":"10%","rule":{"datacenter":"devcycle.us1.prod"}}},"category":"change","message":"payment_processed feature flag has been enabled","tags":["environment:test"],"timestamp":"string","title":"payment_processed feature flag updated"},"type":"event"}}
If an alert event is enabled, set its type.
For example, error, warning, info, success, user_update,
recommendation, and snapshot.
Allowed enum values: error,warning,info,success,user_update,recommendation,snapshot
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (that is no quotes).
Limited to events up to 18 hours in the past and two hours in the future.
device_name
string
A device name.
host
string
Host name to associate with the event.
Any tags associated with the host are also applied to this event.
id
int64
Integer ID of the event.
id_str
string
Handling IDs as large 64-bit numbers can cause loss of accuracy issues with some programming languages.
Instead, use the string representation of the Event ID to avoid losing accuracy.
payload
string
Payload of the event.
priority
enum
The priority of the event. For example, normal or low.
Allowed enum values: normal,low
source_type_name
string
The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc.
The list of standard source attribute values available here.
tags
[string]
A list of tags to apply to the event.
text
string
The body of the event. Limited to 4000 characters. The text supports markdown.
To use markdown in the event text, start the text block with %%% \n and end the text block with \n %%%.
Use msg_text with the Datadog Ruby library.
title
string
The event title.
url
string
URL of the event.
status
string
A status.
{"event":{"alert_type":"info","date_happened":"integer","device_name":"string","host":"string","id":"integer","id_str":"string","payload":"{}","priority":"normal","source_type_name":"string","tags":["environment:test"],"text":"Oh boy!","title":"Did you hear the news today?","url":"string"},"status":"string"}
"""
Get an event returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.events_apiimportEventsApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=EventsApi(api_client)response=api_instance.get_event(event_id=9223372036854775807,)print(response)
# Get an event returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::EventsAPI.newpapi_instance.get_event(9223372036854775807)
// Get an event returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewEventsApi(apiClient)resp,r,err:=api.GetEvent(ctx,9223372036854775807)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `EventsApi.GetEvent`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `EventsApi.GetEvent`:\n%s\n",responseContent)}
// Get an event returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.EventsApi;importcom.datadog.api.client.v1.model.EventResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();EventsApiapiInstance=newEventsApi(defaultClient);try{EventResponseresult=apiInstance.getEvent(9223372036854775807L);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling EventsApi#getEvent");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get an event returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_events::EventsAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=EventsAPI::with_config(configuration);letresp=api.get_event(9223372036854775807).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get an event returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.EventsApi(configuration);constparams: v1.EventsApiGetEventRequest={eventId: 9223372036854775807,};apiInstance.getEvent(params).then((data: v1.EventResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The response object with all events matching the request and pagination information.
Expand All
Field
Type
Description
data
[object]
An array of events matching the request.
attributes
object
The object description of an event response attribute.
attributes
object
Object description of attributes from your event.
aggregation_key
string
Aggregation key of the event.
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (no quotation marks).
Limited to events no older than 18 hours.
device_name
string
A device name.
duration
int64
The duration between the triggering of the event and its recovery in nanoseconds.
event_object
string
The event title.
evt
object
The metadata associated with a request.
id
string
Event ID.
name
string
The event name.
source_id
int64
Event source ID.
type
string
Event type.
hostname
string
Host name to associate with the event.
Any tags associated with the host are also applied to this event.
monitor
object
Attributes from the monitor that triggered the event.
created_at
int64
The POSIX timestamp of the monitor's creation in nanoseconds.
group_status
int32
Monitor group status used when there is no result_groups.
groups
[string]
Groups to which the monitor belongs.
id
int64
The monitor ID.
message
string
The monitor message.
modified
int64
The monitor's last-modified timestamp.
name
string
The monitor name.
query
string
The query that triggers the alert.
tags
[string]
A list of tags attached to the monitor.
templated_name
string
The templated name of the monitor before resolving any template variables.
type
string
The monitor type.
monitor_groups
[string]
List of groups referred to in the event.
monitor_id
int64
ID of the monitor that triggered the event. When an event isn't related to a monitor, this field is empty.
priority
enum
The priority of the event's monitor. For example, normal or low.
Allowed enum values: normal,low
related_event_id
int64
Related event ID.
service
string
Service that triggered the event.
source_type_name
string
The type of event being posted.
For example, nagios, hudson, jenkins, my_apps, chef, puppet, git or bitbucket.
The list of standard source attribute values is available here.
sourcecategory
string
Identifier for the source of the event, such as a monitor alert, an externally-submitted event, or an integration.
status
enum
If an alert event is enabled, its status is one of the following:
failure, error, warning, info, success, user_update,
recommendation, or snapshot.
Allowed enum values: failure,error,warning,info,success,user_update,recommendation,snapshot
tags
[string]
A list of tags to apply to the event.
timestamp
int64
POSIX timestamp of your event in milliseconds.
title
string
The event title.
message
string
The message of the event.
tags
[string]
An array of tags associated with the event.
timestamp
date-time
The timestamp of the event.
id
string
the unique ID of the event.
type
enum
Type of the event.
Allowed enum values: event
default: event
links
object
Links attributes.
next
string
Link for the next set of results. Note that the request can also be made using the
POST endpoint.
meta
object
The metadata associated with a request.
elapsed
int64
The time elapsed in milliseconds.
page
object
Pagination attributes.
after
string
The cursor to use to get the next results, if any. To make the next request, use the same
parameters with the addition of the page[cursor].
request_id
string
The identifier of the request.
status
string
The request status.
warnings
[object]
A list of warnings (non-fatal errors) encountered. Partial results might be returned if
warnings are present in the response.
code
string
A unique code for this type of warning.
detail
string
A detailed explanation of this specific warning.
title
string
A short human-readable summary of the warning.
{"data":[{"attributes":{"attributes":{"aggregation_key":"string","date_happened":"integer","device_name":"string","duration":"integer","event_object":"Did you hear the news today?","evt":{"id":"6509751066204996294","name":"string","source_id":36,"type":"error_tracking_alert"},"hostname":"string","monitor":{"created_at":1646318692000,"group_status":"integer","groups":[],"id":"integer","message":"string","modified":"integer","name":"string","query":"string","tags":["environment:test"],"templated_name":"string","type":"string"},"monitor_groups":[],"monitor_id":"integer","priority":"normal","related_event_id":"integer","service":"datadog-api","source_type_name":"string","sourcecategory":"string","status":"info","tags":["environment:test"],"timestamp":1652274265000,"title":"Oh boy!"},"message":"string","tags":["team:A"],"timestamp":"2019-01-02T09:42:36.320Z"},"id":"AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA","type":"event"}],"links":{"next":"https://app.datadoghq.com/api/v2/events?filter[query]=foo\u0026page[cursor]=eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="},"meta":{"elapsed":132,"page":{"after":"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="},"request_id":"MWlFUjVaWGZTTTZPYzM0VXp1OXU2d3xLSVpEMjZKQ0VKUTI0dEYtM3RSOFVR","status":"done","warnings":[{"code":"unknown_index","detail":"indexes: foo, bar","title":"One or several indexes are missing or invalid. Results hold data from the other indexes."}]}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Search events returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.EventsApi(configuration);constparams: v2.EventsApiSearchEventsRequest={body:{filter:{query:"datadog-agent",from:"2020-09-17T11:48:36+01:00",to:"2020-09-17T12:48:36+01:00",},sort:"timestamp",page:{limit: 5,},},};apiInstance.searchEvents(params).then((data: v2.EventsListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));