Instrument MediaWiki on the WMF production cluster to send structured Action API request information to Hadoop via Kafka.
**Data to collect:**
| Data | Name | Type |
| ---- | ---- | ---- |
| Timestamp | ts | int (unix epoch seconds) |
| Requesting IP | ip | string |
| Requesting User-Agent | userAgent | string |
| Wiki (`wfWikiId()`) | wiki | string |
| Time spent processing request (ms resolution) | timeSpentBackend | int |
| Request parameters (name=value pairs) | params | map<string,string> |
Data will be collected by adding a new debug logging channel (`ApiRequest`) with structured data in the the [[https://www.mediawiki.org/wiki/Structured_logging#Add_structured_data_to_logging_context|PSR-3 context]]. Any MediaWiki deployment can then choose where and how to route these log messages.
For the WMF production cluster, introduce configuration to route this log channel to the local Kafka cluster in a topic that can be loaded into Hadoop.
## Original task description
**log user agent in api.log**
We [[ https://www.mediawiki.org/wiki/API:Main_page#Identifying_your_client | tell clients to use an interesting user agent]], but don't log it to `api.php`.
In T102079#1417411 Anomie commented
> User agent could be included easily enough, but would need to be run by Ops for the text logfile and @bd808 for logstash (if it wouldn't already be there) to verify that it wouldn't make a prohibitive difference to the storage requirements.
Seems a simple change to `ApiMain->logRequest()`, `ApiBase->logFeatureUsage()` already logs user agent to `api-feature-usage.log`.