Log to ElasticSearch via HTTP

Value

The $new() method returns an R6::R6 that inherits from lgr::Appender and can be uses as an appender by a lgr::Logger.

Details

NOTE: Experimental; not yet fully documented and and details are subject to change

Super classes

lgr::Filterable -> lgr::Appender -> lgr::AppenderMemory -> AppenderElasticSearch

Active bindings

conn

a ElasticSearch connection

close_on_exit

TRUE or FALSE. Close the ElasticSearch connection when the Logger is removed?

index

a character scalar or a DBI::Id specifying the target ElasticSearch index

Methods

Inherited methods


Method new()

Usage

AppenderElasticSearch$new(
  conn,
  index,
  threshold = NA_integer_,
  layout = LayoutElasticSearch$new(),
  close_on_exit = TRUE,
  buffer_size = 0,
  flush_threshold = "error",
  flush_on_exit = TRUE,
  flush_on_rotate = TRUE,
  should_flush = NULL,
  filters = NULL
)

Arguments

conn, index

see section Fields

threshold, flush_threshold, layout, buffer_size

see AppenderBuffer A data data.frame. content of index


Method set_close_on_exit()

Usage

AppenderElasticSearch$set_close_on_exit(x)


Method set_conn()

Usage

AppenderElasticSearch$set_conn(conn)


Method get_data()

Usage

AppenderElasticSearch$get_data(
  n = 20L,
  threshold = NA,
  result_type = "data.frame"
)

Arguments

n

integer scalar. Retrieve only the last n log entries that match threshold

threshold

character or integer scalar. The minimum log level that should be displayed

result_type

character scalar. Any of:

  • data.frame

  • data.table (shortcut: dt)

  • list (unprocessed list with ElasticSearch metadata)

  • json (raw ElasticSearch JSON)

Returns

see result_type


Method show()

Usage

AppenderElasticSearch$show(threshold = NA_integer_, n = 20)


Method flush()

Usage

AppenderElasticSearch$flush()