NOTE: Maturing; not yet fully documented but well tested in a production scenario
The $new() method returns an R6::R6 that inherits from
lgr::Appender and can be uses as an appender by a lgr::Logger.
lgr::Filterable -> lgr::Appender -> lgr::AppenderMemory -> AppenderElasticSearch
conna ElasticSearch connection
indextarget ElasticSearch index. May either be:
a character scalar, or
a function returning a character scalar
index_create_bodycharacter scalar json string (or NULL).
a function returning a character scalar json string (or NULL)
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
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()
new()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
)conn, indexsee section Fields
threshold, flush_threshold, layout, buffer_sizesee lgr::AppenderBuffer
A data data.frame. content of index
set_conn()AppenderElasticSearch$set_conn(conn)
get_data()AppenderElasticSearch$get_data(
n = 20L,
threshold = NA,
result_type = "data.frame"
)ninteger scalar. Retrieve only the last n log entries that match
threshold
thresholdcharacter or integer scalar. The minimum log level
that should be displayed
result_typecharacter scalar. Any of:
data.frame
data.table (shortcut: dt)
list (unprocessed list with ElasticSearch metadata)
json (raw ElasticSearch JSON)
see result_type
show()AppenderElasticSearch$show(threshold = NA_integer_, n = 20)
flush()AppenderElasticSearch$flush()
Other Appenders:
AppenderAWSCloudWatchLog,
AppenderDbi,
AppenderDynatrace,
AppenderGmail,
AppenderPool,
AppenderPushbullet,
AppenderSendmail,
AppenderSyslog