DB[:ulog2].filter("timestamp > ?", now - 5.minutes).select{[
BIN_TO_IPV4(:ip_saddr).as(:src_ip),
BIN_TO_IPV4(:ip_daddr).as(:dst_ip),
"sum(if(left(BIN_TO_IPV4(ip_saddr),11) = '192.168.50.', ip_totlen,
0))".lit.as(:outgoing_bytes),
"sum(if(left(BIN_TO_IPV4(ip_saddr),11) = '192.168.50.', 0,
ip_totlen))".lit.as(:incoming_bytes),
sum(:ip_totlen).as(:volume),
count(:_id).as(:packets),
min(:timestamp).as(:flow_start),
max(:timestamp).as(:flow_end)
]}.
group(:ip_saddr, :ip_daddr)
Gives....
NoMethodError: undefined method ‘lit’ for #<String:0x007f91f4378da8>
method block in <main> in show_flows.rb at line 12
method instance_exec in core.rb at line 351
method virtual_row in core.rb at line 351
method virtual_row_columns in query.rb at line 1075
method select in query.rb at line 690
method <main> in show_flows.rb at line 9
This is my first attempt at writing Sequel queries with other than MRI Ruby
1.8.7.
What am I doing wrong? Ruby MRI 2.0, Sequel 4.2.0
Michael
--
http://cybrains.net
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.