send_json: Send logs via the Datadog-API.

Description Usage Arguments Details Value See Also Examples

View source: R/send_logs.R

Description

send_json() is an easy to use function to send logs in json format via the Datadog-API.

Usage

1
send_json(message_body)

Arguments

message_body

the message in plain text format.

Details

Sending logs in json format to the Datadog-API url set with set_api_top_level_domains. If no top level domain is specified .eu will be used.

Value

response of the Datadog-API call.

See Also

send_plain_text, set_api_top_level_domains

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 

# simple example with some attributes
mock_data <- c(http_status = 200,
               hostname = "https://github.com/holzben",
               env = "prod")
# create json
vec_as_json <- jsonlite::toJSON(mock_data)

# send the stuff
send_json(vec_as_json)




# creating some mock data
df <- data.frame(
  http_status = c(200, 400, 500),
  hostname = c("https://github.com/holzben",
               "https://github.com/holzben_not",
               "https://github.com/holzben_not"),
  env = c("prod", "prod", "prod"),
  message = c("All Good: https://github.com/holzben_not",
              "Ok: https://github.com/holzben_not",
              "Not Good: https://github.com/holzben_not"))

send_json(jsonlite::toJSON(df))
 
## End(Not run)

holzben/dogR documentation built on Feb. 21, 2020, 10:25 a.m.