Skip to content

Commit

Permalink
Bug fix in regex notebook.
Browse files Browse the repository at this point in the history
  • Loading branch information
MoessnerFabian(Group) committed Oct 24, 2024
1 parent 89e6d42 commit b995eae
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions doc/source/development/notebooks/processor_examples/regex.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
"rule_path.mkdir(exist_ok=True)\n",
"rule_file = rule_path / \"data-stream.yml\"\n",
"\n",
"if rule_file.exists():\n",
" rule_file.unlink()\n",
"\n",
"processor_config = {\n",
" \"myconcatenator\":{ \n",
" \"type\": \"concatenator\",\n",
Expand All @@ -71,11 +74,12 @@
" }\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",
" rule_file.unlink()\n",
" rule_file.write_text(rule_yaml)\n",
" concatenator = Factory.create(processor_config)\n",
" print(f\"before: {mydocument}\")\n",
" concatenator.process(mydocument)\n",
" print(f\"after: {mydocument}\")\n",
Expand All @@ -95,10 +99,20 @@
"execution_count": 3,
"metadata": {},
"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": [
"\n",
"\n",
"[Deprecation warning]: regex_fields are no longer necessary. Use lucene regex annotation.\n",
"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",
"True\n"
Expand All @@ -120,7 +134,7 @@
" overwrite_target: false\n",
" delete_source_fields: false\n",
"\"\"\"\n",
" \n",
"\n",
"concat_with_rule(rule_yaml)\n"
]
},
Expand All @@ -147,7 +161,7 @@
}
],
"source": [
"rule_yaml2 = \"\"\"---\n",
"rule_yaml = \"\"\"---\n",
"filter: 'data_stream.type: \"/.*lo.*/\"' \n",
"concatenator:\n",
" source_fields:\n",
Expand All @@ -159,7 +173,7 @@
" overwrite_target: false\n",
" delete_source_fields: false\n",
"\"\"\"\n",
"concat_with_rule(rule_yaml2)\n"
"concat_with_rule(rule_yaml)\n"
]
}
],
Expand Down

0 comments on commit b995eae

Please sign in to comment.