Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow while setting too high value for otel logrecord key #265

Open
mitzkia opened this issue Aug 30, 2024 · 2 comments
Open

Overflow while setting too high value for otel logrecord key #265

mitzkia opened this issue Aug 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mitzkia
Copy link
Contributor

mitzkia commented Aug 30, 2024

axosyslog version:

(dbld)micek@DESKTOP-0E9OKG3:/install/sbin$ ./syslog-ng -V
axosyslog 4 (4.8.0.217.g17b1fd8)
Config version: 4.2
Installer-Version: 4.8.0.217.g17b1fd8
Revision:
Compile-Date: Aug 26 2024 05:05:23

Reproduction:
Start axosyslog with the following config:

@version: 4.2

options { stats(level(1)); };

source genmsg {
    example-msg-generator(
        num(1)
        template("foobar")
        values("values.int" => int(10000000000))
    );
};

destination dest_true {
        file (
        dest-true.log
        # template('$MSG')
    );
};

log {
    source(genmsg);
    if {
        filterx {
            $olr = otel_logrecord();
            $olr.dropped_attributes_count = ${values.int};
            $MSG = $olr.dropped_attributes_count;
        };
        destination(dest_true);
    };
};

Notice the overflow in the output ( Setting value; name='MESSAGE', value='4294967295'):

[2024-08-30T20:53:02.245120] syslog-ng starting up; version='4.8.0.217.g17b1fd8'
[2024-08-30T20:53:02.245120] Running application hooks; hook='2'
[2024-08-30T20:53:02.245120] Setting value; name='values.int', value='10000000000', type='int', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Setting value; name='MESSAGE', value='-- Generated message. --', type='string', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Setting value; name='MESSAGE', value='foobar', type='string', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Incoming generated message; msg='foobar'
[2024-08-30T20:53:02.245120] >>>>>> Source side message processing begin; location='filterx-otlp_logrecord.conf:6:5', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Setting value; name='HOST_FROM', value='DESKTOP-0E9OKG3', type='string', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Setting value; name='HOST', value='DESKTOP-0E9OKG3', type='string', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Setting tag; name='.source.genmsg', value='1', msg='0x555a1b45a450'
[2024-08-30T20:53:02.245120] Setting value; name='SOURCE', value='genmsg', type='string', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] >>>>>> filterx rule evaluation begin; rule='#anon-filter0', location='filterx-otlp_logrecord.conf:23:16', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] FILTERX ESTEP; expr='filterx-otlp_logrecord.conf:24:13|    $olr = otel_logrecord()', value='', truthy='1', type='otel_logrecord'
[2024-08-30T20:53:02.245120] FILTERX ESTEP; expr='filterx-otlp_logrecord.conf:25:13|    $olr.dropped_attributes_count = ${values.int}', value='10000000000', truthy='1', type='message_value'
[2024-08-30T20:53:02.245120] FILTERX ESTEP; expr='filterx-otlp_logrecord.conf:26:13|    $MSG = $olr.dropped_attributes_count', value='4294967295', truthy='1', type='integer'
[2024-08-30T20:53:02.245120] <<<<<< filterx rule evaluation result; result='matched', rule='#anon-filter0', location='filterx-otlp_logrecord.conf:23:16', dirty='1', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.245120] Message was cloned; original_msg='0x555a1b45a450', msg='0x555a1b4219c0', rcptid='62'
[2024-08-30T20:53:02.245120] Filterx sync: changed variable in scope, overwriting in message; variable='MESSAGE'
[2024-08-30T20:53:02.245120] Setting value; name='MESSAGE', value='4294967295', type='int', msg='0x555a1b4219c0', rcptid='62'
[2024-08-30T20:53:02.245120] Filterx sync: changed variable in scope, overwriting in message; variable='olr'
[2024-08-30T20:53:02.245120] Setting value; name='olr', value='8����\x0f', type='protobuf', msg='0x555a1b4219c0', rcptid='62'
[2024-08-30T20:53:02.245120] Filterx sync: variable in scope and message in sync, not doing anything; variable='values.int'
[2024-08-30T20:53:02.245120] Initializing destination file writer; template='dest-true.log', filename='dest-true.log', symlink_as='(null)'
[2024-08-30T20:53:02.245120] affile_open_file; path='dest-true.log', fd='14'
[2024-08-30T20:53:02.245120] <<<<<< Source side message processing finish; location='filterx-otlp_logrecord.conf:6:5', msg='0x555a1b45a450', rcptid='62'
[2024-08-30T20:53:02.288473] Outgoing message; message='Aug 30 20:53:02 DESKTOP-0E9OKG3 4294967295\x0a'
[2024-08-30T20:53:02.288473] Window size adjustment; old_window_size='99', window_size_increment='1', suspended_before_increment='FALSE', last_ack_type_is_suspended='FALSE'
^C[2024-08-30T20:53:04.442842] Running application hooks; hook='3'
[2024-08-30T20:53:04.442842] syslog-ng shutting down; version='4.8.0.217.g17b1fd8'
[2024-08-30T20:53:04.543370] stats-aggregator-cps; name='dest_true#0_eps_last_1h', sum='1', divisor='2', cps='0', delta_time_since_start='2'
[2024-08-30T20:53:04.543370] stats-aggregator-cps; name='dest_true#0_eps_last_24h', sum='1', divisor='2', cps='0', delta_time_since_start='2'
[2024-08-30T20:53:04.543370] stats-aggregator-cps; name='dest_true#0_eps_since_start', sum='1', divisor='2', cps='0', delta_time_since_start='2'
[2024-08-30T20:53:04.543370] Closing log transport fd; fd='14'
[2024-08-30T20:53:04.545063] Running application hooks; hook='4'
@mitzkia mitzkia added the bug Something isn't working label Aug 30, 2024
@mitzkia
Copy link
Contributor Author

mitzkia commented Aug 30, 2024

I can extend Light testcases with the validation of this issue.

@mitzkia
Copy link
Contributor Author

mitzkia commented Aug 30, 2024

Other fields can be also affected.
For example:

[2024-08-30T21:22:13.783814] FILTERX ESTEP; expr='filterx-otlp_logrecord.conf:27:13|    $olr = otel_logrecord()', value='', truthy='1', type='otel_logrecord'
[2024-08-30T21:22:13.783814] FILTERX ESTEP; expr='filterx-otlp_logrecord.conf:28:13|    $olr.body = ${values.double}', value='3.2e+22', truthy='0', type='message_value'
[2024-08-30T21:22:13.783814] FILTERX ESTEP; expr='filterx-otlp_logrecord.conf:29:13|    $MSG = $olr.body', value='3.2e+22', truthy='1', type='double'
[2024-08-30T21:22:13.783814] <<<<<< filterx rule evaluation result; result='matched', rule='#anon-filter0', location='filterx-otlp_logrecord.conf:26:16', dirty='1', msg='0x55dccab2d8a0', rcptid='68'
[2024-08-30T21:22:13.783814] Message was cloned; original_msg='0x55dccab2d8a0', msg='0x55dccaaf49c0', rcptid='68'
[2024-08-30T21:22:13.783814] Filterx sync: changed variable in scope, overwriting in message; variable='MESSAGE'
[2024-08-30T21:22:13.783814] Setting value; name='MESSAGE', value='3.2e+22', type='double', msg='0x55dccaaf49c0', rcptid='68'
[2024-08-30T21:22:13.783814] Filterx sync: changed variable in scope, overwriting in message; variable='olr'
[2024-08-30T21:22:13.783814] Setting value; name='olr', value='*        !P����\x1a�D', type='protobuf', msg='0x55dccaaf49c0', rcptid='68'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant