Hi,
from https://docs.basex.org/wiki/Logging I understand all logging in BaseX uses a fixed text format.
For our Kibana/Elastic Search logging solution in OpenShift it is recommended to use JSON as the logging format. Is it possible to make BaseX generate logs in JSON format?
If not, does anyone have any experience importing the BaseX logs into Kibana/Elastic Search?
Hartelijke groet,
Huib Verweij.
Hi Huib,
Is it possible to make BaseX generate logs in JSON format?
You can convert BaseX logs to JSON as follows (just an example):
let $day := '2022-11-28' let $entries := admin:logs($day, true()) let $result := array { for $entry in $entries return map:merge(( $entry/@* ! map:entry(name(), data()), map:entry('message', data($entry)) )) } return json:serialize($result)
…yields something like…
[ { "message": "bla", "user": "admin", "time": "13:18:01.982", "address": "SERVER", "type": "INFO" } ]
There is currently no way to choose different log output formats, as too many BaseX features rely on our standard format.
Hope this helps, Christian
basex-talk@mailman.uni-konstanz.de