---
title: "Hostname root domain (rootdomain)"
canonical: "https://docs.devo.com/space/latest/95200873/Hostname%20root%20domain%20(rootdomain)"
format: markdown
---
> Macro (toc)

## Description

Extracts the root domain from the hostnames in a given string field.

The root domain (*example.com*) is the overarching structure that contains the subdomains (*blog.example.com*), and every folder that belongs to a website. The root domain is the highest level subdomain within a domain listed in the [Public Suffix List](https://publicsuffix.org/). The list contains domains with one or more levels.

## How does it work in the search window?

<span style="color: #282828">S</span>elect **Create field **in the search window toolbar, then select the** Hostname root domain **operation. <span style="color: #282828">You need to specify one argument:</span>

| **Argument** | **Data type** |
| --- | --- |
| **Hostname **<sup><span style="color: #bf2600">mandatory</span></sup> | <span style="color: #282828">*string*</span> |

<span style="color: #282828">The data type of the values in the new field is </span><span style="color: #282828">*string.*</span>

---

### Example

> Macro (rw-ui-textbox-macro)
> 
> The examples in this article use values in a data table generated from the following CSV file.
> 
> If you want to try the example for yourself, download the file and upload it to your domain by clicking** Data upload** in the navigation panel. Name the new table `my.upload.sample.data` and select *Current date* as **Date parsing type**. Learn more about uploading data in [Uploading log files](https://devodocs.atlassian.net/wiki/spaces/latest/pages/94658913).
> 
> After receiving the confirmation message, you can access the table from the Finder, selecting **my → upload → sample → data**. When you upload data from a file, all the information is included in a single column called *message*. To split the values into different columns, you can use the **[Split](https://devodocs.atlassian.net/wiki/spaces/latest/pages/95201437)** operation. Click **Toggle Query Editor** in the search window toolbar and paste the following LINQ query to save time:
> 
> `from my.upload.sample.data`  
> `select split(message, ";", 15) as Hostnames`

---

In the `my.upload.sample.data `table, we want to get the root domains of the hostnames in our **Hostnames **field. To do it, we will create a new field using the **Hostname root domain** operation.

The arguments needed to create the new field are:

- <span style="color: #000000">**Hostname **</span><span style="color: #000000">- </span><span style="color: #000000">**Hostnames **</span><span style="color: #000000">field</span>

![image](media://d5b0197c-ce97-4aaa-9176-dc8bb1fb14e1)

<span style="color: #000000">Click </span><span style="color: #000000">**Create field**</span><span style="color: #000000"> and you will see the following result:</span>

![image](media://c977a66d-c4ae-432f-8202-9db5b3054bab)

## How does it work in LINQ?

Use the operator `select`... `as`...  and add the** **operation syntax to create the new column. This is the syntax for the <span style="color: #000000">**Hostname root domain**</span> operation:

- `rootdomain(string)`

### <span style="color: #282828">Example</span>

<span style="color: #282828">You can copy the following LINQ script and try the above example on the </span>`my.upload.sample.data`<span style="color: #282828"> table. Keep in mind that you must download the CSV file above to your Devo domain.</span>

```
from my.upload.sample.data
select split(message, ";", 15) as Hostnames
select rootdomain(Hostnames) as root_domains
```