<commit_before>﻿<?xml version="1.0" encoding="UTF-8"?>
<chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:svg="http://www.w3.org/2000/svg" xmlns:m="http://www.w3.org/1998/Math/MathML"
    xmlns:html="http://www.w3.org/1999/xhtml" xml:id="modifiers">
    <title>Modifiers</title>
    <para>...</para>
    <section>
        <title>logdata</title>
        <para><emphasis role="bold">Description:</emphasis> Add data to be logged with the event.</para>
        <para><emphasis role="bold">Cardinality</emphasis>: 0..1</para>
        <para><emphasis role="bold">Module:</emphasis> core</para>
        <para><emphasis role="bold">Version:</emphasis> 0.2</para>
        <para>Log a data fragment as part of the error message.</para>
        <programlisting>Rule ARGS "@rx test" \
    "msg:'Test matched',logdata:%{MATCHED_VAR}"</programlisting>
        <para>Note: Up to 128 bytes of data will be recorded.</para>
    </section>
    <section>
        <title>setvar</title>
        <para><emphasis role="bold">Description:</emphasis> Set a variable data field.</para>
        <para><emphasis role="bold">Cardinality</emphasis>: 0..n</para>
        <para><emphasis role="bold">Module:</emphasis> core</para>
        <para><emphasis role="bold">Version:</emphasis> 0.2</para>
        <para>The <literal>setvar</literal> modifier is used for data field manipulation. To create
            a variable data field or change its value:</para>
        <programlisting>setvar:tx:score=1</programlisting>
        <para>To remove all instances of a named variable data field:</para>
        <programlisting>setvar:!tx:score</programlisting>
        <para>To increment or decrement a variable data field value:</para>
        <programlisting>setvar:tx:score=+5
setvar:tx:score=-5</programlisting>
        <para>An attempt to modify a value of a non-numerical variable will assume the old value was
            zero (NOTE: Probably should just fail, logging an attempt was made to modify a
            non-numerical value).</para>
    </section>
</chapter><commit_msg>Update example rule syntax in docs.<commit_after>﻿<?xml version="1.0" encoding="UTF-8"?>
<chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:svg="http://www.w3.org/2000/svg" xmlns:m="http://www.w3.org/1998/Math/MathML"
    xmlns:html="http://www.w3.org/1999/xhtml" xml:id="modifiers">
    <title>Modifiers</title>
    <para>...</para>
    <section>
        <title>logdata</title>
        <para><emphasis role="bold">Description:</emphasis> Add data to be logged with the event.</para>
        <para><emphasis role="bold">Cardinality</emphasis>: 0..1</para>
        <para><emphasis role="bold">Module:</emphasis> core</para>
        <para><emphasis role="bold">Version:</emphasis> 0.2</para>
        <para>Log a data fragment as part of the error message.</para>
        <programlisting>Rule ARGS "@rx test" \
    "msg:Test matched" logdata:%{MATCHED_VAR}</programlisting>
        <para>Note: Up to 128 bytes of data will be recorded.</para>
    </section>
    <section>
        <title>setvar</title>
        <para><emphasis role="bold">Description:</emphasis> Set a variable data field.</para>
        <para><emphasis role="bold">Cardinality</emphasis>: 0..n</para>
        <para><emphasis role="bold">Module:</emphasis> core</para>
        <para><emphasis role="bold">Version:</emphasis> 0.2</para>
        <para>The <literal>setvar</literal> modifier is used for data field manipulation. To create
            a variable data field or change its value:</para>
        <programlisting>setvar:tx:score=1</programlisting>
        <para>To remove all instances of a named variable data field:</para>
        <programlisting>setvar:!tx:score</programlisting>
        <para>To increment or decrement a variable data field value:</para>
        <programlisting>setvar:tx:score=+5
setvar:tx:score=-5</programlisting>
        <para>An attempt to modify a value of a non-numerical variable will assume the old value was
            zero (NOTE: Probably should just fail, logging an attempt was made to modify a
            non-numerical value).</para>
    </section>
</chapter>
{'fraction_non_alphanumeric': 0.15821033210332103, 'fraction_numerical': 0.019833948339483393, 'mean_word_length': 3.4436475409836067, 'pattern_counts': {'":': 0, '<': 141, '<?xml version=': 2, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 16}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5309865', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1293, 'n_words': 317}