Skip to content

Commit

Permalink
Merge branch 'master' of github.com:singlestore-labs/spaces-notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kesmit13 committed Nov 8, 2023
2 parents 4351efd + 17267ca commit a3c2645
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 0 additions & 2 deletions notebooks/network-intrusion-detection-part-1/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"%%sql\n",
"DROP DATABASE IF EXISTS siem_log_kafka_demo;\n",
"\n",
Expand Down Expand Up @@ -484,7 +483,6 @@
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"%%sql\n",
"USE siem_log_kafka_demo;\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/network-intrusion-detection-part-3/meta.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[meta]
title="IT Threat Detection, Part 3"
description="""
Part 3 or Real-time threat Detection - Integrate with Kafka, run
Part 3 of Real-time threat Detection - Integrate with Kafka, run
and visualize Threat Detection on incoming logs.
This notebook requires adjustments to work out of the box."""
icon="browser"
Expand Down
32 changes: 24 additions & 8 deletions notebooks/network-intrusion-detection-part-3/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@
},
{
"cell_type": "markdown",
"id": "f6100d05-d796-452b-893c-8e9240d9a3f9",
"id": "b4cd5073",
"metadata": {},
"source": [
"We start creating a simple table to load the logs into a JSON column"
"### We recommend for that step to use a S1+ size workspace"
]
},
{
"cell_type": "markdown",
"id": "ee260ca9",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\"> <b class=\"fa fa-solid fa-exclamation-circle\"></b> <div> <p><b>Action Required</b></p> <p>Make sure to select the <tt>siem_log_kafka_demo</tt> database from the drop-down menu at the top of this notebook. It updates the <tt>connection_url</tt> which is used by the <tt>%%sql</tt> magic command and SQLAlchemy to make connections to the selected database.</p> </div></div>"
]
},
{
Expand All @@ -53,8 +61,16 @@
"outputs": [],
"source": [
"%%sql\n",
"drop PIPELINE `siem_log_real`;\n",
"drop table `siem_log_real`;"
"DROP PIPELINE IF EXISTS `siem_log_real`;\n",
"DROP TABLE IF EXISTS `siem_log_real`;"
]
},
{
"cell_type": "markdown",
"id": "f6100d05-d796-452b-893c-8e9240d9a3f9",
"metadata": {},
"source": [
"We start creating a simple table to load the logs into a JSON column"
]
},
{
Expand All @@ -65,7 +81,7 @@
"outputs": [],
"source": [
"%%sql\n",
"CREATE TABLE `siem_log_real` (\n",
"CREATE TABLE IF NOT EXISTS `siem_log_real` (\n",
" `logs` JSON COLLATE utf8_bin\n",
" , SHARD KEY ()\n",
") AUTOSTATS_CARDINALITY_MODE=PERIODIC AUTOSTATS_HISTOGRAM_MODE=CREATE SQL_MODE='STRICT_ALL_TABLES';"
Expand All @@ -88,9 +104,9 @@
"source": [
"%%sql\n",
"CREATE PIPELINE `siem_log_real`\n",
"AS LOAD DATA KAFKA 'pkc-XXX.us-east-1.aws.confluent.cloud:9092/connections_siem_logs'\n",
"CONFIG '{\\\"sasl.username\\\": \\\"YOURKEY\\\",\\n \\\"sasl.mechanism\\\": \\\"PLAIN\\\",\\n \\\"security.protocol\\\": \\\"SASL_SSL\\\",\\n \\\"ssl.ca.location\\\": \\\"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem\\\"}'\n",
"CREDENTIALS '{\"sasl.password\": \"YOURPASSWORD\"}'\n",
"AS LOAD DATA KAFKA 'pkc-p11xm.us-east-1.aws.confluent.cloud:9092/singlestore_topic'\n",
"CONFIG '{\\\"sasl.username\\\": \\\"WTIVCYPLUAIMIAYQ\\\",\\n \\\"sasl.mechanism\\\": \\\"PLAIN\\\",\\n \\\"security.protocol\\\": \\\"SASL_SSL\\\",\\n \\\"ssl.ca.location\\\": \\\"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem\\\"}'\n",
"CREDENTIALS '{\"sasl.password\": \"/qIOhlTFEK8RNNCc1qSOnpNj4mqhXfudBlQQFgRfc0qBEjfm99VcyvEuwPILBcnv\"}'\n",
"BATCH_INTERVAL 20\n",
"DISABLE OFFSETS METADATA GC\n",
"INTO TABLE `siem_log_real`\n",
Expand Down

0 comments on commit a3c2645

Please sign in to comment.