I'm trying to write a script that returns stack traces from heroku logs.
Here's an example output I would like to capture:
```PHP Fatal error: Uncaught exception 'Exception' with message 'Invalid authentication source: name' in /app/simplesamlphp/lib/SimpleSAML/Auth/Default.php:61
2018-10-18T20:36:09.617037+00:00 app[web.1]: Stack trace:
2018-10-18T20:36:09.617384+00:00 app[web.1]: #0 /app/simplesamlphp/lib/SimpleSAML/Auth/Simple.php(136): SimpleSAML_Auth_Default::initLogin('sp-name', '...', NULL, Array)
2018-10-18T20:36:09.617681+00:00 app[web.1]: #1 /app/config.php(21): SimpleSAML_Auth_Simple->login(Array)
2018-10-18T20:36:09.618083+00:00 app[web.1]: #2 /app/config.php(38): getSAMLUser('urn:oasis:names...')
2018-10-18T20:36:09.618337+00:00 app[web.1]: #3 /app/login.php(35): getSAMLUserErrorChecking('...')
2018-10-18T20:36:09.618343+00:00 app[web.1]: #4 {main}
2018-10-18T20:36:09.618465+00:00 app[web.1]: thrown in /app/simplesamlphp/lib/SimpleSAML/Auth/Default.php on line 61
2018-10-18T20:38:48.323247+00:00 heroku[router]:
```
I've been trying to use the following to capture the important bits:
heroku logs -t -a appname | grep '(?<=PHP Fatal error)(.*)(?=router)'
edit Here's a proof of concept for the regex I'm using here: https://regex101.com/r/EpCwE0/1