Hi @mmartinez .
This exemple set for another field if the exception is String.
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"script": {
"description": "Extract 'tags' from 'env' field",
"lang": "painless",
"source": """
if(ctx['log'].context.exception instanceof String)
{
ctx['log.context.exception.text'] = ctx['log'].context.exception;
} else {
ctx['log.context.exception'] = ctx['log'].context.exception;
}
""",
"params": {
"delimiter": "-",
"position": 1
}
}
}
]
},
"docs": [
{
"_source": {
"log": {
"context": {
"application_name": "test",
"host": "test-site-8752-hjy6",
"env": "prod",
"remote_ip": "127.0.0.1",
"exception": "TypeError: Return value of App\\Ad\\Domain\\Ad\\LinkAd::getPopunder() must be of the type bool, "
}
}
}
}
]
}