project / project-away / project-rename

project decides which columns the result has. List the columns you want, in the order you want them; every other column is dropped.

SigninLogs
| project TimeGenerated, UserPrincipalName, IPAddress

Inside project you can also rename a column (User = UserPrincipalName) or compute a new one (Domain = tolower(Location)). This makes it the usual last step of a query: it shapes the output that a person will read.

Two related operators save typing:

  • project-away drops the columns you list and keeps all the others. Useful on wide tables when you only want to hide a few noisy columns.
  • project-rename renames columns (New = Old) and keeps everything else, in the same order.

project or extend? extend adds a computed column and keeps all existing ones. project keeps only what you list. If you find yourself writing extend followed by a long project, a single project with the computed column is often enough.

Things to know

  • Column names are case-sensitive: project ipaddress fails when the column is IPAddress.
  • project early in a query does not make it faster in the way where does; its main job is a readable result.
  • On this site, wildcards such as project-away Device* are not supported yet.

Examples

1 Keep four columns, rename one and compute one
DeviceNetworkEvents
| where RemotePort == 389
| project TimeGenerated, DeviceName, Server = RemoteIP, Url = tolower(RemoteUrl)

Server = RemoteIP renames a column; Url = tolower(RemoteUrl) computes a new one. Columns you don't list are gone.

2 Drop the columns you don't need
SecurityEvent
| where EventID == 4672
| project-away Activity, TargetDomainName, Status, SubStatus, LogonProcessName, WorkstationName
3 Rename columns and keep everything else
DeviceNetworkEvents
| where RemotePort == 80
| project-rename Device = DeviceName, Process = InitiatingProcessFileName

Practice it