--- id: as title: as Search Operator sidebar_label: as description: Use the as operator to rename existing fields or create new constant fields in your search results. slug: /help/docs/search/search-query-language/search-operators/as/ canonical: https://www.sumologic.com/help/docs/search/search-query-language/search-operators/as/ --- import useBaseUrl from '@docusaurus/useBaseUrl'; The `as` operator is typically used in conjunction with other operators, but it can also be used alone to rename fields or to create new constant fields. ## Syntax ` as ` ` as ` ## Rules Fields with characters not in the `a-zA-Z0-9_` character set or that begin with a number need to be escaped, see [reference a field with special characters](/docs/search/get-started-with-search/search-basics/reference-field-special-characters) for details. ## Examples ### Rename a Field When you rename a field, the original field still exists, but the new field is added. To rename the existing field `ip_addr` as `src_ip`, use: ```sumo ip_addr as src_ip ``` So, the following full query: ```sumo _sourceCategory=Apache/Access | parse "* - - " as ip_addr | ip_addr as src_ip ``` Would provide results like: Rename ### Create a New Constant Field In this example, you will seed an existing field (`src_ip`) with a new constant (`127.10.10.1`): ```sumo _sourceCategory=Apache/Access | "127.10.10.1" as src_ip ``` This statement “hardcodes" the value of `127.10.10.1` to the variable `src_ip`, for all the messages returned, as shown: New constant In this example, you will create a new field (`test_src_ip`) and seed it with a constant (`127.10.10.1`): ```sumo _sourceCategory=Apache/Access | parse "* - -" as src_ip | "127.10.10.1" as test_src_ip ``` Which provides the following results: New constant ### Use As in Conjunction with Other Operators The `as` operator is useful for testing, for example, when you want to create a few log lines and seed them with specific values, like the following query: ```sumo _sourceCategory=Apache/Access | limit 5 | "127.10.10.1" as src_ip | "404" as status_code | "www.sumologic.com" as url ``` Which provides the following results: Conjunction In this next example, you will use `as` after a parse, to name the variable in the pattern `"\* - - "` as `src_ip`: ```sumo _sourceCategory=Apache/Access | parse "* - - " as src_ip ``` In this example, you will use `as` to rename the `_count` field to `errors`.   ```sumo _sourceCategory=Apache/Access status_code=404 | count(status_code) as errors ```