When we report errors from Logstash to Phabricator we typically focus on two fields:
1. `exception.trace`
2. `exception.message`
The issue is that this is always missing the (arguably) most important part of the back trace, namely where it started. This is stored in `exception.file` and also mixed into `normalized_message` as part of a sentence.
### Example
```name=exception.message
Filter 3342 does not exist
```
* `exception.class`: `MediaWiki\Extension\AbuseFilter\Filter\FilterNotFoundException`
* `exception.file`: `/srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/FilterLookup.php:111`
* `exception.message`: `Filter 3342 does not exist`
* `normalized_message`: ` {exception_id}] {exception_url} MediaWiki\Extension\AbuseFilter\Filter\FilterNotFoundException from line 111 of /srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/FilterLookup.php: Filter 3342 does not exist`
```name=exception.trace,lines=5
#0 /srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/View/AbuseFilterViewHistory.php(58): MediaWiki\Extension\AbuseFilter\FilterLookup->getFilter(integer, boolean)
#1 /srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/Special/SpecialAbuseFilter.php(159): MediaWiki\Extension\AbuseFilter\View\AbuseFilterViewHistory->show()
#2 /srv/mediawiki/php-1.36.0-wmf.25/includes/specialpage/SpecialPage.php(645): MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseFilter->execute(string)
#3 /srv/mediawiki/php-1.36.0-wmf.25/includes/specialpage/SpecialPageFactory.php(1404): SpecialPage->run(string)
#4 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(310): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#5 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(945): MediaWiki->performRequest()
#6 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(548): MediaWiki->main()
#7 /srv/mediawiki/php-1.36.0-wmf.25/index.php(53): MediaWiki->run()
#8 /srv/mediawiki/php-1.36.0-wmf.25/index.php(46): wfIndexMain()
#9 /srv/mediawiki/w/index.php(3): require(string)
#10 {main}
```
### Proposal
Include an extra line at the top of `exception.trace` for the start of the exception, for example:
```name=exception.trace,lines=5,lang=diff
+ #@ /srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/FilterLookup.php(111)
#0 /srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/View/AbuseFilterViewHistory.php(58): MediaWiki\Extension\AbuseFilter\FilterLookup->getFilter(integer, boolean)
#1 /srv/mediawiki/php-1.36.0-wmf.25/extensions/AbuseFilter/includes/Special/SpecialAbuseFilter.php(159): MediaWiki\Extension\AbuseFilter\View\AbuseFilterViewHistory->show()
#2 /srv/mediawiki/php-1.36.0-wmf.25/includes/specialpage/SpecialPage.php(645): MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseFilter->execute(string)
#3 /srv/mediawiki/php-1.36.0-wmf.25/includes/specialpage/SpecialPageFactory.php(1404): SpecialPage->run(string)
#4 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(310): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#5 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(945): MediaWiki->performRequest()
#6 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(548): MediaWiki->main()
#7 /srv/mediawiki/php-1.36.0-wmf.25/index.php(53): MediaWiki->run()
#8 /srv/mediawiki/php-1.36.0-wmf.25/index.php(46): wfIndexMain()
#9 /srv/mediawiki/w/index.php(3): require(string)
#10 {main}
```
Note the added first line with `#@`.
See also T237682, in which I propose for Phatality to report `normalized_message` instead of `exception.message` as otherwise it is missing the `exception.class` which curently leads to some very confusing / contextless reports.