NOTE: Maturing; not yet fully documented but well tested in a production scenario

Value

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

Super classes

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

Active bindings

conn

a ElasticSearch connection

index

target ElasticSearch index. May either be:

  • a character scalar, or

  • a function returning a character scalar

index_create_body

Methods

Inherited methods


Method new()

Usage

AppenderElasticSearch$new(
  conn,
  index,
  threshold = NA_integer_,
  layout = LayoutElasticSearch$new(),
  index_create_body = NULL,
  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 lgr::AppenderBuffer A data data.frame. content of index


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()