Re: [pmacct-discussion] ipv4 conversion to int

2018-04-21 Thread Anthony Caiafa
Ok let me test this out. Thanks!

On Sat, Apr 21, 2018 at 9:33 AM Paolo Lucente  wrote:

>
> Hi Anthony,
>
> The problem with your specific lines is the name, src_host and dst_host.
> These are reserved. As Yann was proposing, use instead src_host_int and
> dst_host_int for example. In your 'aggregate' line you will also have to
> modify src_host and dst_host into src_host_int and dst_host_int. I tried
> this working for me.
>
> Paolo
>
> On Thu, Apr 19, 2018 at 03:01:24PM -0400, Anthony Caiafa wrote:
> > Yep that didnt work when i tried it. It still exported the src_host a
> string.
> >
> > On Thu, Apr 19, 2018 at 2:58 PM, Paolo Lucente  wrote:
> > >
> > > Hi Anthony,
> > >
> > > Yes, nice tip from Yann actually - i'm going to document it :) This
> > > would work and is portable across all plugins, you can give it a try.
> > > Specifically for the SQL plugins, which i understand is not your case,
> > > a sql_num_hosts feature exists - failing the custom primitive approach
> > > for any unforeseen reason, we could consider a porting of this feature.
> > >
> > > Paolo
> > >
> > > On Thu, Apr 19, 2018 at 11:04:24AM -0400, Anthony Caiafa wrote:
> > >> So this should technically work?
> > >>
> > >> name=src_hostfield_type=8 len=4   semantics=u_int
> > >> name=dst_hostfield_type=12len=4   semantics=u_int
> > >>
> > >> Going against the direct keys instead of creating a new one for
> src_host_int.
> > >>
> > >> On Thu, Apr 19, 2018 at 10:05 AM, Anthony Caiafa <2600...@gmail.com>
> wrote:
> > >> > yeah backend is clickhouse and it has a similar function. However
> > >> > conversion for range queries is meh. might as well store as an int.
> > >> >
> > >> > On Thu, Apr 19, 2018 at 7:21 AM, Karl O. Pinc  wrote:
> > >> >> On Thu, 19 Apr 2018 07:30:12 +
> > >> >> Yann Belin  wrote:
> > >> >>
> > >> >>> As far as I know it doesn't but if you use nfacctd, you can easily
> > >> >>> define your own primitives to do the same job:
> > >> >>
> > >> >>> On Thu, Apr 19, 2018 at 12:14 AM Anthony Caiafa <
> 2600...@gmail.com>
> > >> >>> wrote:
> > >> >>>
> > >> >>> > Does this feature currently exist? Having the ability to convert
> > >> >>> > the ipv4 key field to an int?
> > >> >>
> > >> >> Another option would be to save your data in PostgreSQL
> > >> >> and use the ip address data type, converting from there
> > >> >> on output if necessary.
> > >> >>
> > >> >> https://www.postgresql.org/docs/10/static/datatype-net-types.html
> > >> >>
> > >> >> Regards,
> > >> >>
> > >> >> Karl 
> > >> >> Free Software:  "You don't pay back, you pay forward."
> > >> >>  -- Robert A. Heinlein
> > >> >>
> > >> >> ___
> > >> >> pmacct-discussion mailing list
> > >> >> http://www.pmacct.net/#mailinglists
> > >>
> > >> ___
> > >> pmacct-discussion mailing list
> > >> http://www.pmacct.net/#mailinglists
> > >
> > > ___
> > > pmacct-discussion mailing list
> > > http://www.pmacct.net/#mailinglists
>
___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Re: [pmacct-discussion] ipv4 conversion to int

2018-04-21 Thread Paolo Lucente

Hi Anthony,

The problem with your specific lines is the name, src_host and dst_host.
These are reserved. As Yann was proposing, use instead src_host_int and
dst_host_int for example. In your 'aggregate' line you will also have to
modify src_host and dst_host into src_host_int and dst_host_int. I tried
this working for me.

Paolo
 
On Thu, Apr 19, 2018 at 03:01:24PM -0400, Anthony Caiafa wrote:
> Yep that didnt work when i tried it. It still exported the src_host a string.
> 
> On Thu, Apr 19, 2018 at 2:58 PM, Paolo Lucente  wrote:
> >
> > Hi Anthony,
> >
> > Yes, nice tip from Yann actually - i'm going to document it :) This
> > would work and is portable across all plugins, you can give it a try.
> > Specifically for the SQL plugins, which i understand is not your case,
> > a sql_num_hosts feature exists - failing the custom primitive approach
> > for any unforeseen reason, we could consider a porting of this feature.
> >
> > Paolo
> >
> > On Thu, Apr 19, 2018 at 11:04:24AM -0400, Anthony Caiafa wrote:
> >> So this should technically work?
> >>
> >> name=src_hostfield_type=8 len=4   semantics=u_int
> >> name=dst_hostfield_type=12len=4   semantics=u_int
> >>
> >> Going against the direct keys instead of creating a new one for 
> >> src_host_int.
> >>
> >> On Thu, Apr 19, 2018 at 10:05 AM, Anthony Caiafa <2600...@gmail.com> wrote:
> >> > yeah backend is clickhouse and it has a similar function. However
> >> > conversion for range queries is meh. might as well store as an int.
> >> >
> >> > On Thu, Apr 19, 2018 at 7:21 AM, Karl O. Pinc  wrote:
> >> >> On Thu, 19 Apr 2018 07:30:12 +
> >> >> Yann Belin  wrote:
> >> >>
> >> >>> As far as I know it doesn't but if you use nfacctd, you can easily
> >> >>> define your own primitives to do the same job:
> >> >>
> >> >>> On Thu, Apr 19, 2018 at 12:14 AM Anthony Caiafa <2600...@gmail.com>
> >> >>> wrote:
> >> >>>
> >> >>> > Does this feature currently exist? Having the ability to convert
> >> >>> > the ipv4 key field to an int?
> >> >>
> >> >> Another option would be to save your data in PostgreSQL
> >> >> and use the ip address data type, converting from there
> >> >> on output if necessary.
> >> >>
> >> >> https://www.postgresql.org/docs/10/static/datatype-net-types.html
> >> >>
> >> >> Regards,
> >> >>
> >> >> Karl 
> >> >> Free Software:  "You don't pay back, you pay forward."
> >> >>  -- Robert A. Heinlein
> >> >>
> >> >> ___
> >> >> pmacct-discussion mailing list
> >> >> http://www.pmacct.net/#mailinglists
> >>
> >> ___
> >> pmacct-discussion mailing list
> >> http://www.pmacct.net/#mailinglists
> >
> > ___
> > pmacct-discussion mailing list
> > http://www.pmacct.net/#mailinglists

___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists


Re: [pmacct-discussion] ipv4 conversion to int

2018-04-19 Thread Anthony Caiafa
Yep that didnt work when i tried it. It still exported the src_host a string.

On Thu, Apr 19, 2018 at 2:58 PM, Paolo Lucente  wrote:
>
> Hi Anthony,
>
> Yes, nice tip from Yann actually - i'm going to document it :) This
> would work and is portable across all plugins, you can give it a try.
> Specifically for the SQL plugins, which i understand is not your case,
> a sql_num_hosts feature exists - failing the custom primitive approach
> for any unforeseen reason, we could consider a porting of this feature.
>
> Paolo
>
> On Thu, Apr 19, 2018 at 11:04:24AM -0400, Anthony Caiafa wrote:
>> So this should technically work?
>>
>> name=src_hostfield_type=8 len=4   semantics=u_int
>> name=dst_hostfield_type=12len=4   semantics=u_int
>>
>> Going against the direct keys instead of creating a new one for src_host_int.
>>
>> On Thu, Apr 19, 2018 at 10:05 AM, Anthony Caiafa <2600...@gmail.com> wrote:
>> > yeah backend is clickhouse and it has a similar function. However
>> > conversion for range queries is meh. might as well store as an int.
>> >
>> > On Thu, Apr 19, 2018 at 7:21 AM, Karl O. Pinc  wrote:
>> >> On Thu, 19 Apr 2018 07:30:12 +
>> >> Yann Belin  wrote:
>> >>
>> >>> As far as I know it doesn't but if you use nfacctd, you can easily
>> >>> define your own primitives to do the same job:
>> >>
>> >>> On Thu, Apr 19, 2018 at 12:14 AM Anthony Caiafa <2600...@gmail.com>
>> >>> wrote:
>> >>>
>> >>> > Does this feature currently exist? Having the ability to convert
>> >>> > the ipv4 key field to an int?
>> >>
>> >> Another option would be to save your data in PostgreSQL
>> >> and use the ip address data type, converting from there
>> >> on output if necessary.
>> >>
>> >> https://www.postgresql.org/docs/10/static/datatype-net-types.html
>> >>
>> >> Regards,
>> >>
>> >> Karl 
>> >> Free Software:  "You don't pay back, you pay forward."
>> >>  -- Robert A. Heinlein
>> >>
>> >> ___
>> >> pmacct-discussion mailing list
>> >> http://www.pmacct.net/#mailinglists
>>
>> ___
>> pmacct-discussion mailing list
>> http://www.pmacct.net/#mailinglists
>
> ___
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists

___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists


Re: [pmacct-discussion] ipv4 conversion to int

2018-04-19 Thread Anthony Caiafa
yeah backend is clickhouse and it has a similar function. However
conversion for range queries is meh. might as well store as an int.

On Thu, Apr 19, 2018 at 7:21 AM, Karl O. Pinc  wrote:
> On Thu, 19 Apr 2018 07:30:12 +
> Yann Belin  wrote:
>
>> As far as I know it doesn't but if you use nfacctd, you can easily
>> define your own primitives to do the same job:
>
>> On Thu, Apr 19, 2018 at 12:14 AM Anthony Caiafa <2600...@gmail.com>
>> wrote:
>>
>> > Does this feature currently exist? Having the ability to convert
>> > the ipv4 key field to an int?
>
> Another option would be to save your data in PostgreSQL
> and use the ip address data type, converting from there
> on output if necessary.
>
> https://www.postgresql.org/docs/10/static/datatype-net-types.html
>
> Regards,
>
> Karl 
> Free Software:  "You don't pay back, you pay forward."
>  -- Robert A. Heinlein
>
> ___
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists

___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists


Re: [pmacct-discussion] ipv4 conversion to int

2018-04-19 Thread Anthony Caiafa
Ah true. Let me give this a whirl.

On Thu, Apr 19, 2018 at 3:32 AM Yann Belin  wrote:

> As far as I know it doesn't but if you use nfacctd, you can easily define
> your own primitives to do the same job:
>
> name=src_host_intfield_type=8 len=4   semantics=u_int
> name=dst_host_intfield_type=12len=4   semantics=u_int
>
> Then, you can use those primitives instead of the standard ones in your
> config.
>
> On Thu, Apr 19, 2018 at 12:14 AM Anthony Caiafa <2600...@gmail.com> wrote:
>
>> Does this feature currently exist? Having the ability to convert the ipv4
>> key field to an int?
>>
> ___
>> pmacct-discussion mailing list
>> http://www.pmacct.net/#mailinglists
>
> ___
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists
___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Re: [pmacct-discussion] ipv4 conversion to int

2018-04-19 Thread Yann Belin
As far as I know it doesn't but if you use nfacctd, you can easily define
your own primitives to do the same job:

name=src_host_intfield_type=8 len=4   semantics=u_int
name=dst_host_intfield_type=12len=4   semantics=u_int

Then, you can use those primitives instead of the standard ones in your
config.

On Thu, Apr 19, 2018 at 12:14 AM Anthony Caiafa <2600...@gmail.com> wrote:

> Does this feature currently exist? Having the ability to convert the ipv4
> key field to an int?
> ___
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists
___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

[pmacct-discussion] ipv4 conversion to int

2018-04-18 Thread Anthony Caiafa
Does this feature currently exist? Having the ability to convert the ipv4
key field to an int?
___
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists