diff --git a/doc/source/development/notebooks/processor_examples/regex.ipynb b/doc/source/development/notebooks/processor_examples/regex.ipynb index 4f2e9ba34..f933f9e62 100644 --- a/doc/source/development/notebooks/processor_examples/regex.ipynb +++ b/doc/source/development/notebooks/processor_examples/regex.ipynb @@ -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", @@ -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", @@ -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" @@ -120,7 +134,7 @@ " overwrite_target: false\n", " delete_source_fields: false\n", "\"\"\"\n", - " \n", + "\n", "concat_with_rule(rule_yaml)\n" ] }, @@ -147,7 +161,7 @@ } ], "source": [ - "rule_yaml2 = \"\"\"---\n", + "rule_yaml = \"\"\"---\n", "filter: 'data_stream.type: \"/.*lo.*/\"' \n", "concatenator:\n", " source_fields:\n", @@ -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" ] } ],