Hi @kmfreder1
Are you trying to substitute or just extract the TLD I am confused?
gsub
... substitutes....
Did you look at ....
Then you could set it to the field you want... and removed the temp data if you want...
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"registered_domain": {
"field": "dns.question.name",
"target_field": "dns_details"
}
},
{
"set": {
"field": "dns.question.registered_domain",
"value": "{{dns_details.top_level_domain}}"
}
}
]
},
"docs": [
{
"_source": {
"dns": {
"question": {
"name": "www.example.ac.uk"
}
}
}
},
{
"_source": {
"dns": {
"question": {
"name": "www.example.com"
}
}
}
},
{
"_source": {
"dns": {
"question": {
"name": "test-example6.domain.com"
}
}
}
},
{
"_source": {
"dns": {
"question": {
"name": "another.test-example.another-domain.com"
}
}
}
}
]
}
#Results
{
"docs": [
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"dns": {
"question": {
"registered_domain": "ac.uk",
"name": "www.example.ac.uk"
}
},
"dns_details": {
"registered_domain": "example.ac.uk",
"top_level_domain": "ac.uk",
"domain": "www.example.ac.uk",
"subdomain": "www"
}
},
"_ingest": {
"timestamp": "2023-04-01T01:48:11.925942306Z"
}
}
},
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"dns": {
"question": {
"registered_domain": "com",
"name": "www.example.com"
}
},
"dns_details": {
"registered_domain": "example.com",
"top_level_domain": "com",
"domain": "www.example.com",
"subdomain": "www"
}
},
"_ingest": {
"timestamp": "2023-04-01T01:48:11.926014019Z"
}
}
},
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"dns": {
"question": {
"registered_domain": "com",
"name": "test-example6.domain.com"
}
},
"dns_details": {
"registered_domain": "domain.com",
"top_level_domain": "com",
"domain": "test-example6.domain.com",
"subdomain": "test-example6"
}
},
"_ingest": {
"timestamp": "2023-04-01T01:48:11.926022263Z"
}
}
},
{
"doc": {
"_index": "_index",
"_id": "_id",
"_version": "-3",
"_source": {
"dns": {
"question": {
"registered_domain": "com",
"name": "another.test-example.another-domain.com"
}
},
"dns_details": {
"registered_domain": "another-domain.com",
"top_level_domain": "com",
"domain": "another.test-example.another-domain.com",
"subdomain": "another.test-example"
}
},
"_ingest": {
"timestamp": "2023-04-01T01:48:11.926024921Z"
}
}
}
]
}
Add the following if you want to clean up
,
{
"remove": {
"field": "dns_details"
}
}