···11# **Osprey User Interface Guide**
223344-[Left Column: Query](#left-column:-query)
5466-- [Query Box](#query-box)
55+The Osprey UI has several pages accessible by a left-hand menu:
7688-- [History](#history)
77+
981010-- [Saved Queries](#saved-queries)
1191212-[Middle Column: Charts](#middle-column:-charts)
1010+Home will bring you to the default page of Osprey, with three main columns.
13111414-- [Time Series Chart](#time-series-chart)
1212+**NOTE: The Event Stream in the right column is not yet in v0, and will be available before or in v1.**
15131616-- [Top N Results](#top-n-results)
1414+
17151818-[Right Column: Event Stream](#right-column:-event-stream)
1616+### Left Column: Query
19172020-[Query Syntax](?tab=t.h06jr5e5c3ep#heading=h.9h8pnmwkkyrc)
1818+#### **Query Box**
21192222-- [Basic Query Structure](#actions)
2020+The Osprey Query UI uses the same SML syntax as rules, but for searching and filtering near-real-time and historical data rather than creating new rules. Using the test data generator, you can try writing a query to look for an action called “create\_post” specifically from a given User ID.
2121+
23222424-- [Combining Conditions](#combining-conditions)
2525-2626-- [Using UDFs in Queries](#using-udfs-in-queries)
2727-2828-- [Label Queries](#label-queries)
2929-3030-[Example Queries](#example-queries)
3131-3232-The Osprey UI has several pages accessible by a left-hand menu:
3333-3434-3535-Home will bring you to the default page of Osprey, with three main columns. **NOTE: The Event Stream in the right column is not yet in v0, and will be available before or in v1.**
3636-3737-3838-### Left Column: Query {#left-column:-query}
3939-4040-#### **Query Box** {#query-box}
4141-4242-The Osprey Query UI uses the same SML syntax as rules, but for searching and filtering near-real-time and historical data rather than creating new rules. Using the test data generator, you can try writing a query to look for an action called “create\_post” specifically from a given User ID.
43234424You can also use a UDF in your query. If you ever forget what a UDF does, you can hover on the information symbol for a tip:
2525+
45264627A query can be run against a time window ranging from the last second to the last 3 months (and also a custom range):
2828+
472948304931The Osprey UI is designed to be dynamic and update in real-time. If any other component in the other two columns is interacted with, the query will automatically update and vice versa. The query also automatically populates the URL. This can be handy for sharing a specific query with someone on a team, but may present privacy risks.
50325151-#### **History** {#history}
3333+
3434+3535+#### **History**
52365337Every query is logged in the Query History view, and there is a dropdown filter to only show queries that you have run.
54385555-5639When you hover over the query, it will also show the Top N Charts used during the query session (more on that below).
57404141+
58425959-The Query History can also be accessed and seen in a different format via the left-side menu.
4343+The Query History can also be accessed and seen in a different format via the left-side menu. From here you can filter by the user who ran the query, view the original query, and run it using the same time range the original query used.
60446161-#### **Saved Queries** {#saved-queries}
4545+
4646+4747+#### **Saved Queries**
62486349If there are specific queries that are used often, Osprey provides the ability to save a query:
64505151+
5252+6553The user who initiated the query and when the query was first run is logged as part of the Saved Query. Saved Queries can also be accessed via the left-side menu. The user who saved the query and what time it was saved is logged and visible. There is a drop-down menu at the top to filter saved queries by users.
66545555+
67566868-### Middle Column: Charts {#middle-column:-charts}
5757+### Middle Column: Charts
69587059The middle column in Osprey shows two types of charts: **Time Series** and **Top N Results**. Both sections provide the ability to add extra charts to see different slices of time or types of top results.
71606161+
72627373-#### **Time Series Chart** {#time-series-chart}
6363+#### **Time Series Chart**
74647565The Time Series chart shows a visualization of the results in the query over a period of time. The time ranges include:
7666···8373* Month
84748575Hovering over a bar in the time series chart shows how many events took place during that time.
7676+
7777+86788779There is also a time and date picker above the time series chart where you can set a custom range:
8080+
88818982An extra table can be added for another view of a different unit of time. To get rid of the table, you can “[yeet](https://www.urbandictionary.com/define.php?term=Yeet) it”.
8383+
908491859292-#### **Top N Results** {#top-n-results}
8686+#### **Top N Results**
93879488Adding a Top N Results table populates a table with the top results for the results of the query. You can view and assign labels to a specific entity by hovering over it and clicking “Edit Labels”
8989+
95909191+**NOTE: Labels are not yet in v0**
9292+9393+
96949797-### Right Column: Event Stream {#right-column:-event-stream}
9595+You can also select PoP (Period over Period) to compare the query results with results from a window of time in the past to see the delta.
9696+9797+
9898+9999+### Right Column: Event Stream
9810099101**The Event Stream is not yet in v0, and will be available before or in v1.**
102102+100103The Event Stream is essentially Osprey's "live feed" and investigation dashboard where security teams can:
101104102105* Monitor real-time activity
···106109* Drill down into specific users/entities
107110108111It provides a more detailed view of each event that matches the query. The Event Stream can show metadata related to accounts that can link to other internal tools that provide detailed information about an account and/or further enforcement actions.
112112+
113113+109114110115The event stream is also viewable in a card format vs a list format (list format shown in the screenshot).
111116112117Osprey users may have personal preferences on how to do investigations and what information is most helpful for them. Osprey makes it easy to customize the types of information shown in the Event Stream by clicking “Summary Features”
118118+
113119114120115121### Labeling
116122117123**Note: Labels are not yet in v0, but will come in v1**
118124Any unique entity can be labeled in the Osprey UI. This manual labeling tool is used by Safety teams to tag individual entities (users, IPs, emails, etc.) with labels. Labels are essentially the manual annotation tool that feeds into Osprey's automated rule system, allowing human judgment to enhance machine detection. Labels can be positive, negative, or neutral. Examples:
119119-**Negative Labels: Harmful/problematic behavior**
120125126126+**Negative Labels: Harmful/problematic behavior**
121127* Examples: "spammer", "bot", "banned", "suspicious"
122128123129**Positive Labels: Good/trusted behavior**
124124-125130* Examples: "verified", "trusted", "premium\_user"
126131127132**Neutral Labels: Informational tags**
128128-129133* Examples: "new\_user", "from\_mobile", "beta\_tester"
130134131135132136Below are examples of a new label interface from v0, and an example from Discord’s usage of labels (coming in v1).
137137+
138138+
133139134140135141### UDF Documentation
136142137143The UDF Documentation page can be accessed via the left-side menu. It dynamically updates based on the code, so any new UDFs added will show up on this page. This page essentially serves as the "API reference" for the SML language, making it easy for users to discover and properly use all available functions when writing rules and queries.
144144+
138145139146This page can be used as a manual for writing SML rules or queries, guide for understanding parameter types and requirements, and act as a plugin discovery portal to explore what custom UDFs are loaded.
140147···143150**Note: Since Bulk Labeling relies on Labels, it does not yet work in v0.**
144151145152There are two ways to bulk label items in Osprey: the left-side menu and via the chart column. In this example, you can bulk label all the users that have posted a message that is not empty:
153153+
146154147147-Bulk labels can be dangerous if there’s a false positive\! Osprey provides a counter of how many unique entities are about to be bulk labeled at the top. Labels can be positive, negative, or neutral. A reason must be provided when labeling anything. Each bulk job will create a unique task ID and log the user who initiated the bulk job, the status of the bulk labeling, and a link to the query that the bulk job originated from.
155155+156156+**Bulk labels can be dangerous if there’s a false positive\!** Osprey provides a counter of how many unique entities are about to be bulk labeled at the top. Labels can be positive, negative, or neutral. A reason must be provided when labeling anything. Each bulk job will create a unique task ID and log the user who initiated the bulk job, the status of the bulk labeling, and a link to the query that the bulk job originated from.
148157149158To view all bulk labeling jobs that have been done, click into “Bulk Job History” from the left-side menu. You’ll need the unique task ID to look up a bulk job.
159159+
150160151161152162### Rule Visualizer
···159169* **Blue square:** rule
160170* **Green circle:** label downstream of a rule
161171172172+
173173+174174+162175### Query Syntax
163176164164-#### **Actions** {#actions}
177177+#### **Actions**
165178166179Actions are events that are sent to Osprey. An event is simply something that happens. When a user does something like create a post, send a message, change their username, etc an event happens to represent that. There are probably a lot of events emitted in your org, and Osprey doesn’t need to consume all of them.
167180···207220MessageText != Null
208221```
209222210210-#### **Combining Conditions** {#combining-conditions}
223223+#### **Combining Conditions**
211224212225Let’s say you’re looking for any matches where a user tried to login more than 3 times. You can create a query to check for two types of data fields: “EventType” and “LoginAttempts”.
213226···222235 (UserId == 123) or (UserId == 456)
223236```
224237225225-#### **Using UDFs in Queries** {#using-udfs-in-queries}
238238+#### **Using UDFs in Queries**
226239227240UDFs (read more [here](https://github.com/roostorg/osprey/blob/f16da6e5c32ae124c3cc6e2d7efded7cea1ac726/docs/rules.md#user-defined-functions-udfs)) are a powerful part of queries. Once you define a UDF with the specific desired logic, you can reference it in a query.
228241···237250 ListLength(list=UserConnections) > 10
238251```
239252240240-#### **Label Queries** {#label-queries}
253253+#### **Label Queries**
241254242255**Important Note: Labels are not yet in v0, so these will not work in the UI.**
243256···254267255268###
256269257257-### Example Queries {#example-queries}
270270+### Example Queries
258271259272```py
260273# Find suspicious login attempts: