AIUI the data flow for ApiFeatureUsage is:
- ApiBase::logFeatureUsage()
- wfDebugLog( 'api-feature-usage' )
- Wikimedia's monolog setup
- logstash
- a sanitized version to the elasticsearch cluster used by CirrusSearch
I've been thinking for a while (ever since I tried to set up the extension locally for testing) that a db backed version of ApiFeatureUsage would be nice to have for small wikis, and would make it a lot easier to set up. We could use a Psr\Log\LoggerInterface logger in ApiBase::logFeatureUsage() that is overridable via a setter, use a hook to set a custom logger that does writes to the db if configured. That could also be used by the elasticsearch version to directly put the events inside the cluster we use to query instead of going through logstash (though maybe we do want them in logstash anyways?)