Skip to content

Commit

Permalink
Adjusting Notebook to new format.
Browse files Browse the repository at this point in the history
  • Loading branch information
MoessnerFabian(Group) committed Jan 9, 2025
1 parent 402e600 commit dcf0d09
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions doc/source/development/notebooks/processor_examples/regex.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -62,11 +62,12 @@
"processor_config = {\n",
" \"myconcatenator\":{ \n",
" \"type\": \"concatenator\",\n",
" \"specific_rules\": [str(rule_path)],\n",
" \"generic_rules\": [\"/dev\"],\n",
" \"rules\": [str(rule_path), \"/dev\"],\n",
" }\n",
" }\n",
"\n",
"concatenator = Factory.create(processor_config)\n",
"\n",
"def concat_with_rule(rule_yaml):\n",
" mydocument = deepcopy(document)\n",
" if rule_file.exists():\n",
Expand All @@ -87,9 +88,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[Deprecated]: regex_fields are no longer necessary. Use Lucene regex annotation.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"before: {'data_stream': {'dataset': 'windows', 'namespace': 'devopslab', 'type': '/logs/'}, '_op_type': 'create'}\n",
"after: {'data_stream': {'dataset': 'windows', 'namespace': 'devopslab', 'type': '/logs/'}, '_op_type': 'create', '_index': '/logs/-windows-devopslab'}\n"
]
}
],
"source": [
"rule_yaml = \"\"\"---\n",
"filter: 'data_stream.type: \".*lo.*\"'\n",
Expand All @@ -106,6 +123,7 @@
" delete_source_fields: false\n",
"\"\"\"\n",
"\n",
"\n",
"concat_with_rule(rule_yaml)\n"
]
},
Expand All @@ -118,9 +136,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"before: {'data_stream': {'dataset': 'windows', 'namespace': 'devopslab', 'type': '/logs/'}, '_op_type': 'create'}\n",
"after: {'data_stream': {'dataset': 'windows', 'namespace': 'devopslab', 'type': '/logs/'}, '_op_type': 'create', '_index': '/logs/-windows-devopslab'}\n"
]
}
],
"source": [
"rule_yaml = \"\"\"---\n",
"filter: 'data_stream.type: /.*log.*/' \n",
Expand All @@ -146,9 +173,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"before: {'data_stream': {'dataset': 'windows', 'namespace': 'devopslab', 'type': '/logs/'}, '_op_type': 'create'}\n",
"after: {'data_stream': {'dataset': 'windows', 'namespace': 'devopslab', 'type': '/logs/'}, '_op_type': 'create', '_index': '/logs/-windows-devopslab'}\n"
]
}
],
"source": [
"rule_yaml = \"\"\"---\n",
"filter: 'data_stream.type: /\\\\/lo.*/' \n",
Expand Down

0 comments on commit dcf0d09

Please sign in to comment.