Log to ElasticSearch
AppenderElasticSearch.RdNOTE: 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
connindextarget ElasticSearch index. May either be:
a
characterscalar, ora
functionreturning acharacterscalar
index_create_bodycharacterscalar json string (orNULL).a
functionreturning acharacterscalar json string (orNULL) Optional settings, mappings, aliases, etc... in case the target index has to be created by the logger. See https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-create
Methods
Inherited methods
lgr::Filterable$add_filter()lgr::Filterable$filter()lgr::Filterable$remove_filter()lgr::Filterable$set_filters()lgr::Appender$set_layout()lgr::Appender$set_threshold()lgr::AppenderMemory$append()lgr::AppenderMemory$clear()lgr::AppenderMemory$format()lgr::AppenderMemory$set_buffer_size()lgr::AppenderMemory$set_flush_on_exit()lgr::AppenderMemory$set_flush_on_rotate()lgr::AppenderMemory$set_flush_threshold()lgr::AppenderMemory$set_should_flush()
Method new()
Usage
AppenderElasticSearch$new(
conn,
index,
threshold = NA_integer_,
layout = ElasticSearchLayout,
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, indexsee section Fields
threshold, flush_threshold, layout, buffer_sizesee lgr::AppenderBuffer A data
data.frame. content of index
Method get_data()
Arguments
nintegerscalar. Retrieve only the lastnlog entries that matchthresholdthresholdcharacterorintegerscalar. The minimum log level that should be displayedresult_typecharacterscalar. Any of:data.framedata.table(shortcut:dt)list(unprocessed list with ElasticSearch metadata)json(raw ElasticSearch JSON)