---
updatedAt: 2026-09-24T20:14:35.000Z
agentTools:
  projectIndex: https://docs.observeinc.com/llms.txt
---

# Get started with OPAL

Follow this tutorial to learn how to use the Observe Processing and Analysis Language (OPAL) to shape your data into business-focused information.

# Scenario

As the owner of a chain of Grab and Go stores, you want business information from your Point of Sale (PoS) to track sales data. From your PoS logs, you can extract data about the following information:

* When items are purchased (Timestamp)
* Employee Name
* Employee ID
* Activity Performed
* Store Number
* Store Name
* City
* State

You can shape this data using OPAL to answer these questions:

* Most activity at a store
* Employee who handled each transaction
* Register ID for the transaction

In this tutorial, you learn to shape and model your data using OPAL, the language used by Observe by Snowflake to perform database tasks.

# Ingest data into Observe by Snowflake

Before working with OPAL, you must ingest your data into Observe by Snowflake using a Datastream and an Ingest Token. Use the following steps to start your ingestion process:

1. Log into your Observe by Snowflake instance, and click **Datastreams**.
2. Click **Create Datastream**.
3. Enter **IntroductionToOPAL** as the Name.
4. (Optional) Enter a short description of the Datastream.
5. (Optional) Enter a data retention period. In this case, let's say one week.

<Image src="https://files.readme.io/5b1f7f8d742957f2d3ccd8856fd136d45c89e93918470457dd3c0e1bc67401c2-Screenshot_2026-09-23_at_11.02.40_AM.png" align="center" width="350em" border={true} />

<br />

5. Click **Create**.

<Image src="https://files.readme.io/dfe0557a9299054dca5b3fd8985a61e64de3cffec7ba43fd4369fca128d3b01a-Screenshot_2026-09-23_at_11.05.23_AM.png" align="center" border={true} />

## Add an ingest token to your datastream

To allow data into your Datastream, you must create a unique ingest token. Use the following steps to create an ingest token:

1. To add a new ingest token, click **Create**, then select **Token**.
2. Enter **IntroductionToOPALToken** as the name.
3. (Optional) Enter a short description of the ingest token.

<Image src="https://files.readme.io/50bbfc698ed8cc8a7cc521488bb97673b2ff494acae2899ba0a44361391500f7-Screenshot_2026-09-23_at_11.07.15_AM.png" align="center" width="350em" border={true} />

4. Click **Continue**.
5. You receive a confirmation message confirming the creation of your token creation and the token value.
6. Click **Copy to clipboard** to copy the token value and then save it in a secure location.

<Callout icon="📘" theme="info">
  ### Note

  You can only view the token once in the confirmation message. If you don’t copy and paste the token into a secure location, and you lose the token, you have to create a new one.
</Callout>

7. Once you copy it into a secure location, select the confirmation checkbox, and then click **Continue**.
8. After you click **Continue**, Observe displays setup instructions for using the new ingest token.

<Image src="https://files.readme.io/f30afcd48f8d2e367a1c4efbf8c166ec71ec7462a2c864fd6f34885327aa8a63-Screenshot_2026-09-23_at_11.08.12_AM.png" align="center" width="600em" border={true} />

The URL `https://{customerID}.collect.observeinc.com/` displays your customer ID and URL for ingesting data.

<Callout icon="📘" theme="info">
  ### Note

  Some Observe by Snowflake instances may optionally use a name instead of Customer ID; if this is the case for your instance, contact your Observe by Snowflake data engineer to discuss implementation. A stem name will work as is, but a DNS redirect name may require client configuration.
</Callout>

HTTP requests must include your customer ID and ingest token information.

You can view the setup instructions on your Datastream’s **About** tab.

## Use cURL to ingest data into the tutorial datastream

This tutorial uses three log files containing point-of-sales (PoS) data that you must send to your Observe by Snowflake instance. [Download all three files from GitHub](https://github.com/observeinc/tutorials).

After you download the files, put them in the following locations:

* macOS - `home/<yourusername>`
* Windows - `C:\Users\<yourusername`

You can send this data to the `v1/http` endpoint using cURL. See [Endpoints](https://docs.observeinc.com/docs/endpoints#/) for more details.

The path component of the URL is encoded as a tag. Query parameters also encoded as tags. To accomplish this, add the path, `OPAL101`, and the query parameter, `version`. Keep this information in mind for use later in the tutorial.

Copy and paste the following cURL to ingest the log data from the three log files into the Datastream. Replace `${CustomerID}` with your Customer ID, such as `123456789012`.

```curl
curl "https://${CustomerID}.collect.observeinc.com/v1/http/OPAL101?version=version1" \
-H "Authorization: Bearer {token_value}" \
-H "Content-type: text/plain" \
--data-binary @./PoSActivity1.log
```

```curl
curl "https://${CustomerID}.collect.observeinc.com/v1/http/OPAL101?version=version2" \
-H "Authorization: Bearer {token_value}" \
-H "Content-type: text/plain" \
--data-binary @./PoSActivity2.log
```

```curl
curl "https://${CustomerID}.collect.observeinc.com/v1/http/OPAL101?version=version3" \
-H "Authorization: Bearer {token_value}" \
-H "Content-type: text/plain" \
--data-binary @./PoSActivity3.log
```

Each cURL command returns `{"ok":true}` when successful. After ingesting the data, you should see the data in the Datastream, IntroductionToOPAL.

<Image src="https://files.readme.io/d148653872c21ddc5d13671c70daefdced0a59d7ef621399672c9e606dd65962-Screenshot_2026-09-23_at_11.28.37_AM.png" align="center" border={true} />

Hover on the Dataset name, then click the share icon (<i class="fa-regular fa-arrow-up-right-from-square"></i>) to open the Dataset.

<Image src="https://files.readme.io/b890702d2caac7d5a606d93593ee465807e1236ef97728110a60e92542ae746b-Screenshot_2026-09-23_at_2.17.28_PM.png" border={true} />

# Shape data with OPAL

Use OPAL to shape the raw log data. Shaping data means transforming the raw data into structured, usable datasets for analysis, dashboards, or alerts.

## Create a Worksheet for your Dataset

To create a Worksheet to start modeling your data, click **Open in Worksheet** at the top of your IntroductionToOPAL Dataset. A Worksheet contains similarities to most spreadsheet applications. It uses column headings, columns, and rows to logically group your data.

<Image src="https://files.readme.io/47f3b54cb1f8735de28b0213d3dd407aa84b2115591e1c31f73a8db1ff468233-Screenshot_2026-09-23_at_2.18.45_PM.png" align="center" border={true} />

To begin modeling using OPAL, open the OPAL console located just under the Worksheet.

## Use OPAL to shape your data

What you will do in this section:

* Use [`make_col`](https://docs.observeinc.com/docs/verb-make_col#/) to extract columns
* Use [`filter`](https://docs.observeinc.com/docs/verb-filter#/) to filter the Dataset
* Use [`make_col`](https://docs.observeinc.com/docs/verb-make_col#/) and [`trim`](https://docs.observeinc.com/docs/function-trim#/) to extract and format columns
* Use [`extract_regex`](https://docs.observeinc.com/docs/verb-extract_regex#/) and regular expressions to extract columns
* Use [`parse_timestamp`](https://docs.observeinc.com/docs/function-parse_timestamp#/) to convert a column to a timestamp
* Use [`from_milliseconds`](https://docs.observeinc.com/docs/function-from_milliseconds#/) to convert timestamp columns
* Use [`parse_kvs`](https://docs.observeinc.com/docs/function-parse_kvs#/) to extract from columns
* Use [`pick_col`](https://docs.observeinc.com/docs/verb-pick_col#/) to select the columns you want to display

### Use `make_col` to extract columns

First, let’s experiment with semi-structured data. Semi-structured data can consist of data such as emails, comma-separated values, JSON, etc.

When you ingested the data into Observe by Snowflake, you added a custom path and query string parameter to the HTTP ingestion endpoint. You can find these in the Extra column:

<Image src="https://files.readme.io/086b371838cf722952d592e1162d3a168408654823bebfe54d77490b5f39cdd7-Screenshot_2026-09-23_at_2.19.52_PM.png" align="center" border={true} />

When you double-click on any incoming row cell in the **Extra** column, the side panel displays the following:

<Image src="https://files.readme.io/8cded4c24d1cdf65584a19c549dae00a5f2da16adb765cb17198a4ee8b148a92-Screenshot_2026-09-23_at_2.20.41_PM.png" align="center" border={true} />

The data in the **Extra** column shows that the data has a JSON object format. You can manipulate this data using the [`make_col`](https://docs.observeinc.com/docs/verb-make_col#/) projection operation.

Click the code icon (<i class="fa-regular fa-code"></i>) to open the OPAL console, then enter the following code and click **Run**:

<OpalCodeBlock
  code={
`// Extract the path and version of the sent file from the EXTRA column 
make_col path:string(EXTRA.path) 
make_col version:string(EXTRA.version)
`}
/>

<Image src="https://files.readme.io/288ab16b1b39baee1c21eccd6bb156faf7a6e499ecd48a6ae0019e16cc91c28d-Screenshot_2026-09-23_at_2.23.30_PM.png" align="center" width="600em" border={true} />

Let’s look at the components of the following OPAL expression and understand each one:

```text
make_col path:string(EXTRA.path) 
```

| OPAL           | Description                                                                                               |
| -------------- | --------------------------------------------------------------------------------------------------------- |
| `make_col`     | The [`make_col`](https://docs.observeinc.com/docs/verb-make_col) verb creates new columns.                                             |
| `path`         | The name of the column you want to create. In this case, it's **path**.                                   |
| `string`       | Cast the value in the expression to **string** data type.                                                 |
| `(EXTRA.path)` | The fully qualified path to the desired value in the **EXTRA** column. In this case, it's **EXTRA.path**. |

Note that the [`make_col`](https://docs.observeinc.com/docs/verb-make_col#/) verb can evaluate multiple expressions at once and span multiple lines in the code editor.

The following OPAL expression combines both expressions into a single operation but provides the same output as the previous expression:

<OpalCodeBlock
  code={
`// Extract the path and version of the sent file from the EXTRA column
make_col path:string(EXTRA.path), version:string(EXTRA.version)
`}
/>

### Use `filter` to filter the Dataset

Next, let’s look at filtering using the OPAL language in Observe by Snowflake.

In the previous section, you extracted two columns, path and version, contained in the Extra column and converted them to strings. Now, learn to use columns with explicit equality filters.

Copy the following code, and paste it into your OPAL console. Click Run at the top of the OPAL console.

<OpalCodeBlock
  code={
`// Filter to just the rows sent from the file with specific version 
filter path = "/OPAL101" 
filter version = "version3"
`}
/>

Now you have filtered the incoming dataset to display just one of the ingested log files.

<Image src="https://files.readme.io/88683ed66583f5f9617c553a052aaa2c921e154cace3ac0037592643665e074f-Screenshot_2026-09-23_at_2.36.24_PM.png" align="center" border={true} />

Let’s understand the components of the expression:

| OPAL       | Description                                         |
| ---------- | --------------------------------------------------- |
| `filter`   | The [`filter`](https://docs.observeinc.com/docs/verb-filter) verb.               |
| `path`     | The column to compare. In this case, it's **path**. |
| `=`        | The predicate.                                      |
| `/OPAL101` | The value to compare.                               |

But you want to evaluate all of the data, so remove the filter `version = "version3"` line of OPAL and click **Run** to revert back to all input versions.

<OpalCodeBlock
  code={
`// Extract the path and version of the sent file from the EXTRA column 
make_col path:string(EXTRA.path)
make_col version:string(EXTRA.version)
// Filter to just the rows sent from the file with specific version 
filter path = "/OPAL101"
`}
/>

Remember that you removed the OPAL expression version:string(EXTRA.version) so that you can model all versions of the data.

### Use `make_col` and `trim` to extract and format columns

This section reviews how multiple functions can be combined together to extract and clean data. The contents of the ingested log files can be found in the Fields column, specifically in the text property. Double-click on any row in the **Fields** column to review the data in the Inspect window:

<Image src="https://files.readme.io/173bb5076f0a51168857c97107b40a1409f3c24539fe54056f580d679776c516-field-details-2.png" align="center" border={true} />

The value details reveal line breaks at the end of each line, `\r\n`:

```text OPAL
{
  "text": "2023-03-17 05:31:47,541 INFO Session: A123 Program: POS.TransactionComplete [sessionInfo: state=OPEN employeeId=11304 employeeName=Neil Armstrong securityRole=40 autoLockTime=900000 training=false registerID=001 storeNumber=XY123 storeName=[Amazing Teddy Bears] storeCity=Seattle storeState=WA storeCountry=US] [transactionInfo: associateId=11304 txType=sales lineItemCount=6 subtotal=7808 tax=764 total=8572] systemTime=1680217291429\r\n"
}
```

Enter the following OPAL expression and click **Run** at the top of the OPAL console:

<OpalCodeBlock
  code={
`// Extract message column and trim extra carriage return/line feed
make_col message:trim(string(FIELDS.text), "\r\n")
`}
/>

This expression applies the [`trim`](https://docs.observeinc.com/docs/function-trim#/) function in addition to the string value extracted from the column and removes carriage returns and line feed characters.

The new **message** column displays the following information without unnecessary characters.

<Image src="https://files.readme.io/ef0d927f45a681be19576797b2d60706162a0dd37525ca09e83b62425514afe7-Screenshot_2026-09-24_at_10.58.07_AM.png" align="center" border={true} />

Here’s the explanation of the [`trim`](https://docs.observeinc.com/docs/function-trim#/) expression:

| OPAL          | Description                                                     |
| ------------- | --------------------------------------------------------------- |
| `make_col`    | The verb to make a new column.                                  |
| `message`     | The name of the new column you are creating.                    |
| `trim`        | Function to remove characters from the enclosed values.         |
| `string`      | Cast the value in the expression to string data type.           |
| `FIELDS.text` | Fully qualified path to the desired value in the FIELDS column. |
| `\r\n`        | The values you want to remove using the trim function.          |

### Use `extract_regex` and regular expressions to extract columns

Next, create columns using regular expressions.

The message column appears to contain interesting business data about your stores. Using the [`extract_regex`](https://docs.observeinc.com/docs/verb-extract_regex#/) verb, you can easily convert that unstructured string into structured data.

Enter the following code in the OPAL console, and click **Run**.

<OpalCodeBlock
  code={
`// Extract log timestamp, error level and program
extract_regex message, /(?P<logtimestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\s(?P<errorlevel>INFO|DEBUG|ERROR|WARN).*Program:\s(?P<program>\w*\.\w*)/, "i"
// Extract session details
extract_regex message, /sessionInfo:\s(?P<sessioninfo>.*)]/, "i"
// Extract session ID
extract_regex message, /Session:\s(?P<sessionid>\w\d{3})/, "i"
// Extract system timestamp
extract_regex message, /systemTime=(?P<systemtime>\d*)/, "i"
`}
/>

The new **logtimestamp**, **errorlevel**, **program**, **sessioninfo**, **sessionid**, and **systemtime** columns now display in the Worksheet.

<Image src="https://files.readme.io/7eb6fc5e40bb7068486f3f9345203605538e30716e9645596e6392839ad07abc-Screenshot_2026-09-24_at_11.04.52_AM.png" align="center" border={true} />

Below is a description of the expression components:

| OPAL                                                           | Description                                                                                                      |
| :------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
| `extract_regex`                                                | Extract columns with regular expressions verb.                                                                   |
| `message`                                                      | The column to be parsed.                                                                                         |
| `/(?P<logtimestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})` | Named capture group called **logtimestamp** capturing sequence of numbers like "2023-03-17 05:31:47,541".        |
| `\s`                                                           | Space character.                                                                                                 |
| `(?P<errorlevel>INFO\|DEBUG\|ERROR\|WARN)`                     | Named capture group called **errorlevel** capturing values from the list of "INFO", "DEBUG", "ERROR" and "WARN". |
| `.*`                                                           | Any character.                                                                                                   |
| `Program:\s`                                                   | Exact match of **Program** followed by a space.                                                                  |
| `(?P<program>\w*\.\w*)`                                        | Named capture group called **program** capturing two strings separated by period.                                |
| `"i"`                                                          | Modifiers, in this case specifying case-insensitive parsing.                                                     |

### Use `parse_timestamp` to convert a column to a timestamp

Your next step converts parsed values from their default string representation to more appropriate types of values.
OPAL uses `parse_isotime` to parse the ISO 8601 timestamp format, but the example data doesn’t appear to be ISO 8601 timestamp format. However, you can easily parse the timestamp with the [`parse_timestamp`](https://docs.observeinc.com/docs/function-parse_timestamp#/) function.

Enter the following expression into the OPAL console, and click **Run**.

<OpalCodeBlock
  code={
`// Parse timestamp
make_col logtimestamp:parse_timestamp(logtimestamp, "YYYY-MM-DD HH24:MI:SS,FF3")
`}
/>

The **logtimestamp** column of the string type already exists, but now you have overwritten it using the new **logtimestamp** column of timestamp type.

<Image src="https://files.readme.io/3185e580018e36b72058014000cf8130fb3d25da631159b12ec618f0cb23067b-Screenshot_2026-09-24_at_11.06.47_AM.png" align="center" border={true} />

Below is a description of the expression components:

| Expression component          | Description                                                       |
| :---------------------------- | :---------------------------------------------------------------- |
| `make_col`                    | Make column verb.                                                 |
| `logtimestamp`                | The name of the resulting column (**logtimestamp**).              |
| `parsetimestamp`              | Function to parse the timestamp.                                  |
| `(logtimestamp`               | The name of the source column (also **logtimestamp**).            |
| `"YYYY-MM-DD HH24:MI:SS,FF3"` | Format of the timestamp using Snowflake's time format specifiers. |

### Use `from_milliseconds` to convert timestamp columns

OPAL provides full support for Unix timestamps with [`from_nanoseconds`](https://docs.observeinc.com/docs/function-from_nanoseconds#/), [`from_milliseconds`](https://docs.observeinc.com/docs/function-from_milliseconds#/), and [`from_seconds`](https://docs.observeinc.com/docs/function-from_seconds#/) functions. Let’s explore these a little more.

Enter the following expression into the OPAL console, and click **Run**.

<OpalCodeBlock
  code={
`// Parse system timestamp into time
make_col systemTime:from_milliseconds(int64(systemtime))
`}
/>

OPAL column names are case-sensitive. Therefore, the example produces a new column **systemTime**, distinct and different from **systemtime** even though they only differ by case:

<Image src="https://files.readme.io/fad2c9be31831228f19338faacf9f8682c8c3d5c0d536d353cf33b60550b2607-Screenshot_2026-09-24_at_11.08.12_AM.png" align="center" border={true} />

Below is a description of the expression components:

| OPAL                | Description                                      |
| ------------------- | ------------------------------------------------ |
| `make_col`          | Verb to make a new column.                       |
| `systemTime`        | The name of the new column you want to create.   |
| `from_milliseconds` | Function to convert time from UNIX milliseconds. |
| `int64`             | Convert the time to a 64-bit integer.            |
| `systemtime`        | The name of the source column.                   |

### Use `parse_kvs` to extract from columns

OPAL simplifies many common parsing challenges, including key/value pair parsing using the [`parse_kvs`](https://docs.observeinc.com/docs/function-parse_kvs#/) function.

Enter the following expression into the OPAL console, and click **Run**.

<OpalCodeBlock
  code={
`// Parse session information which are key/value pairs
make_col sessioninfo_KVPairs:parse_kvs(sessioninfo)

// Create session information columns
make_col 
    employeeName:string(sessioninfo_KVPairs.employeeName),
    employeeId:int64(sessioninfo_KVPairs.employeeId),
    storeCountry:string(sessioninfo_KVPairs.storeCountry),
    storeState:string(sessioninfo_KVPairs.storeState),
    storeCity:string(sessioninfo_KVPairs.storeCity),
    storeNumber:string(sessioninfo_KVPairs.storeNumber),
    registerID:string(sessioninfo_KVPairs.registerID),
    autoLockTime:int64(sessioninfo_KVPairs.autoLockTime),
    transaction_total:int64(sessioninfo_KVPairs.total),
    storeName:string(sessioninfo_KVPairs.storeName)

// Mark the numeric employeeId column enumerable so it shows better in UI
set_col_enum employeeId:true
`}
/>

The [`parse_kvs`](https://docs.observeinc.com/docs/function-parse_kvs) function splits incoming data from commonly used delimiters, and you can easily add your own delimiters, and produces a column with an object with key/value pair properties.

<Image src="https://files.readme.io/e947b889ea20ca0de03951585b6b4357d43932d037b64792ccce39e624d8bb2c-Screenshot_2026-09-24_at_11.13.13_AM.png" align="center" border={true} />

The OPAL expression creates additional columns using the now familiar [`make_col`](https://docs.observeinc.com/docs/verb-make_col#/) verb.

<Image src="https://files.readme.io/abcbe3968b6544aad55792c4c86b04dd8a80bb08369a943e159031984dc9fd40-Screenshot_2026-09-24_at_11.14.34_AM.png" align="center" border={true} />

Even though a column such as **autoLockTime** is numeric, you want to enumerate all the possible values instead of showing the numeric range. Use the [`set_col_enum`](https://docs.observeinc.com/docs/verb-set_col_enum#/) verb to mark a column as enumeration, click on the column header, and the right panel displays the enumeration of all the values.

<Image src="https://files.readme.io/6427e4ef38f4e28114a618cf67e40cdbd032c2527c37cefa1231d1907f0b6cd5-Screenshot_2026-09-24_at_1.09.15_PM.png" align="center" border={true} />

### Use `pick_col` to select the columns you want to display

You’ve created a lot of intermediate columns so far in this tutorial. Now you can use the [`pick_col`](https://docs.observeinc.com/docs/verb-pick_col#/) verb to choose the columns you want to see as the final result and optionally rename them.

Enter the following expression into the OPAL console, and click **Run**.

<OpalCodeBlock code={
`// Choose the columns, sometimes renaming them. Drop all the others
pick_col 
    BUNDLE_TIMESTAMP,
    systemtime,
    logtimestamp,
    "Error Level":errorlevel,
    "Activity Performed":program,
    sessionid, autoLockTime,
    storeCity, storeState, storeCountry,
    storeNumber, registerID,
    employeeName, employeeId,    
    message,
    transaction_total, storeName
`}/>

This example selects just the columns you want and in the exact sequence you want. The expression uses the column binding expression to rename the **errorLevel** column to **Error Level** and the **program** column to **Activity Performed**.

<Image src="https://files.readme.io/7ee0067bb2ca9ec06d3476193abcc074729f5ca98f794d2f719de0ff8ed5b528-pick_column.png" align="center" border={true} />

# Create visualizations for sales data

Next, you want to view the sales data for each store by employee to see which store has the top salespeople.

Add the following OPAL to your OPAL console:

<OpalCodeBlock
  code={
`filter @."Activity Performed" = "POS.TransactionComplete"
timechart options(empty_bins:true), A_transaction_total_sum:sum(transaction_total), group_by(storeName, employeeName)
`}
/>

You can now view your stores by sales transactions by clicking Visualize and selecting **Visualization > Type > Pie Chart**:

<Image src="https://files.readme.io/302d3422825fb02943d0d205c09d75279635e03d8f9b8124555df394285e8af6-sales_data.png" align="center" border={true} />

To visualize the data as a Line Chart, select **Line Chart** and click **Apply**:

<Image src="https://files.readme.io/d961822e37f8d385f941555e17c204ea1d3144bd611b56783014f406d5885fbd-line-graph-dash.png" align="center" border={true} />

Move your cursor over a data point to display information about it.

To visualize the data as a Bar Chart, select **Bar Chart** and click **Apply**:

<Image src="https://files.readme.io/f24b328ecd955d028fb89fa30e549f2ea7544604c55270207e21c20a4b19c0a8-bar-chart1.png" align="center" border={true} />

To visualize the data as a Stacked Area, select **Stacked Area** and click **Apply**.

<Image src="https://files.readme.io/330208b6e4a09718dea1918b5ed6b74b447d2ab6bc12ad38bd8801b9a3a357a8-stacked-area1.png" align="center" border={true} />

To visualize the data as a Single Stat, select **Single Stat**, and then under Settings, select **A\_transaction\_total\_sum**. Click **Apply**.

<Image src="https://files.readme.io/a0f0064ec9d5b1412ed6e11a7211f3b8c6418bd9d8d09d5732cc6c1cbe8cc7a8-single-stat1.png" align="center" border={true} />

Use the Visualization type that best presents your data to your team.

# Tutorial wrap-up

To wrap up the tutorial, enter a name for your Worksheet, such as **OPAL101 Tutorial**, and click **Save**.

When you review the column message, you can see the PoS activity including Login StartTime, sessionInfo, AddItem, and TransactionComplete. This data helps you understand the number of transactions per day, who transacted the sale, and when the transaction finished.

## Complete OPAL script used in this tutorial

Below is the complete OPAL script used in this tutorial:

<OpalCodeBlock
  code={
`// Extract the path and version of the sent file from the EXTRA column 
make_col path:string(EXTRA.path) 
make_col version:string(EXTRA.version)

// Filter to just the rows sent from the file with specific version 
filter path = "/OPAL101" 

// Extract message column and trim extra carriage return/line feed
make_col message:trim(string(FIELDS.text), "\r\n")

// Extract log timestamp, error level and program
extract_regex message, /(?P<logtimestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\s(?P<errorlevel>INFO|DEBUG|ERROR|WARN).*Program:\s(?P<program>\w*\.\w*)/, "i"
// Extract session details
extract_regex message, /sessionInfo:\s(?P<sessioninfo>.*)]/, "i"
// Extract session ID 
extract_regex message, /Session:\s(?P<sessionid>\w\d{3})/, "i"
// Extract system timestamp
extract_regex message, /systemTime=(?P<systemtime>\d*)/, "i"

// Parse timestamp
make_col logtimestamp:parse_timestamp(logtimestamp, "YYYY-MM-DD HH24:MI:SS,FF3")

// Parse system timestamp into time
make_col systemTime:from_milliseconds(int64(systemtime))

// Parse session information which are key/value pairs
make_col sessioninfo_KVPairs:parse_kvs(sessioninfo)

// Create session information columns
make_col 
    employeeName:string(sessioninfo_KVPairs.employeeName),
    employeeId:int64(sessioninfo_KVPairs.employeeId),
    storeCountry:string(sessioninfo_KVPairs.storeCountry),
    storeState:string(sessioninfo_KVPairs.storeState),
    storeCity:string(sessioninfo_KVPairs.storeCity),
    storeNumber:string(sessioninfo_KVPairs.storeNumber),
    registerID:string(sessioninfo_KVPairs.registerID),
    autoLockTime:int64(sessioninfo_KVPairs.autoLockTime),
    transaction_total:int64(sessioninfo_KVPairs.total),
    storeName:string(sessioninfo_KVPairs.storeName)

// Mark the numeric employeeId column enumerable so it shows better in UI
set_col_enum employeeId:true

// Choose the columns, sometimes renaming them. Drop all the others
pick_col 
    BUNDLE_TIMESTAMP,
    systemTime,
    logtimestamp,
    "Error Level":errorlevel,
    "Activity Performed":program,
    sessionid, autoLockTime,
    storeCity, storeState, storeCountry,
    storeNumber, registerID,
    employeeName, employeeId,    
    message,
    transaction_total, storeName

    
// added for dashboarding tutorial
filter @."Activity Performed" = "POS.TransactionComplete"
timechart options(empty_bins:true), A_transaction_total_sum:sum(transaction_total), group_by(storeName, employeeName)
`}
/>

## Key takeaways from this tutorial

In this tutorial, you learned how to perform the following tasks:

* Create a Datastream to ingest data.
* Create an Ingest Token for the Datastream.
* Use cURL to ingest your PoS log files into Observe by Snowflake.
* Create a Worksheet from your Dataset.
* Use OPAL to shape your data.