Mailing List Archive

sparseArray documentation
Hi.

I'm reading
https://www.rsyslog.com/doc/master/configuration/lookup_tables.html and
I believe there's some mistake with wording regarding sparse arrays.

Quoting: "*Match criterion*: A match happens on the first index that is
less than or equal to the looked-up key."

If it were so, if I started my table on index=0, every single match
should happen on this value since it's obviously less than or equal to
any looked-up integer. So, judging from the example (and from what I'd
expect it to be) it's rather that match happens on the first index that
is bigger than or equal, not less than or equal.

And, for the sake of completness, it would be great to include info that
sparseArray should also consist of monotonic indexes. I assume that the
author assumed "inheritance" from previous paragraph describing normal
array.


Best regards,

MK

_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
Re: sparseArray documentation [ In reply to ]
it should be the largest index that is less than or equal to the key you are
looking up.

The use case in mind for this feature was the maxmind GeoIP database, which
converts the IP addresses into 32bit integers and lists the first IP of each
block

so when you lookup an IP address, convert it to a 32 bit integer and then you
want the largest item that's not larger than what you are looking up.

David Lang


On Tue, 2 Feb 2021, Mariusz Kruk via rsyslog wrote:

> Date: Tue, 2 Feb 2021 14:21:55 +0100
> From: Mariusz Kruk via rsyslog <rsyslog@lists.adiscon.com>
> To: rsyslog@lists.adiscon.com
> Cc: Mariusz Kruk <mkr@safecomp.com>
> Subject: [rsyslog] sparseArray documentation
>
> Hi.
>
> I'm reading
> https://www.rsyslog.com/doc/master/configuration/lookup_tables.html and I
> believe there's some mistake with wording regarding sparse arrays.
>
> Quoting: "*Match criterion*: A match happens on the first index that is less
> than or equal to the looked-up key."
>
> If it were so, if I started my table on index=0, every single match should
> happen on this value since it's obviously less than or equal to any looked-up
> integer. So, judging from the example (and from what I'd expect it to be)
> it's rather that match happens on the first index that is bigger than or
> equal, not less than or equal.
>
> And, for the sake of completness, it would be great to include info that
> sparseArray should also consist of monotonic indexes. I assume that the
> author assumed "inheritance" from previous paragraph describing normal array.
>
>
> Best regards,
>
> MK
>
> _______________________________________________
> rsyslog mailing list
> https://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com/professional-services/
> What's up with rsyslog? Follow https://twitter.com/rgerhards
> NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
> sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T
> LIKE THAT.
>
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
Re: sparseArray documentation [ In reply to ]
Yes, I know. And that's how I'm using it :-)

I'm just mentioning the wording on the documentation webpage. It states
"less then or equal" instead of "bigger than or equal".


On 02/02/2021 20:38, David Lang wrote:

> it should be the largest index that is less than or equal to the key
> you are looking up.
>
> The use case in mind for this feature was the maxmind GeoIP database,
> which converts the IP addresses into 32bit integers and lists the
> first IP of each block
>
> so when you lookup an IP address, convert it to a 32 bit integer and
> then you want the largest item that's not larger than what you are
> looking up.
>
> David Lang
>
>
>  On Tue, 2 Feb 2021, Mariusz Kruk via rsyslog wrote:
>
>> Date: Tue, 2 Feb 2021 14:21:55 +0100
>> From: Mariusz Kruk via rsyslog <rsyslog@lists.adiscon.com>
>> To: rsyslog@lists.adiscon.com
>> Cc: Mariusz Kruk <mkr@safecomp.com>
>> Subject: [rsyslog] sparseArray documentation
>>
>> Hi.
>>
>> I'm reading
>> https://www.rsyslog.com/doc/master/configuration/lookup_tables.html
>> and I believe there's some mistake with wording regarding sparse arrays.
>>
>> Quoting: "*Match criterion*: A match happens on the first index that
>> is less than or equal to the looked-up key."
>>
>> If it were so, if I started my table on index=0, every single match
>> should happen on this value since it's obviously less than or equal
>> to any looked-up integer. So, judging from the example (and from what
>> I'd expect it to be) it's rather that match happens on the first
>> index that is bigger than or equal, not less than or equal.
>>
>> And, for the sake of completness, it would be great to include info
>> that sparseArray should also consist of monotonic indexes. I assume
>> that the author assumed "inheritance" from previous paragraph
>> describing normal array.
>>
>>
>> Best regards,
>>
>> MK
>>
>> _______________________________________________
>> rsyslog mailing list
>> https://lists.adiscon.net/mailman/listinfo/rsyslog
>> http://www.rsyslog.com/professional-services/
>> What's up with rsyslog? Follow https://twitter.com/rgerhards
>> NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a
>> myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT
>> POST if you DON'T LIKE THAT.
>>
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.