5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-28 07:46:22 +00:00

Merge branch 'blazer' into panel.sutty.nl

This commit is contained in:
f 2022-04-29 20:06:43 -03:00
commit 062612eff8

View file

@ -33,39 +33,30 @@ class UriCollectionJob < PeriodicJob
site.hostnames.each do |host|
break if stop?
dimensions = { host: host }
uris.each do |uri|
break if stop?
dimensions[:uri] = uri
rollup('host|uri', beginning, **dimensions)
reduce_rollup('host|uri', beginning, **dimensions)
rollup('host|uri', beginning, host: host, uri: uri)
reduce_rollup('host|uri', beginning, host: host, uri: uri)
end
dimensions.delete(:uri)
# Reducir todas las visitas a cantidad de visitas por host
recursive_rollup(name: 'host|uri',
new_name: 'host',
interval_previous: starting_interval,
interval: starting_interval,
dimensions: dimensions,
dimensions: { host: host },
beginning: beginning)
# Acumular por mes y año
reduce_rollup('host', beginning, **dimensions)
reduce_rollup('host', beginning, host: host)
columns = %i[http_referer geoip2_data_country_name]
columns.each do |column|
# Obtener orígenes de visitas por host
AccessLog.where(host: host).distinct(column).pluck(column).each do |value|
dimensions.delete_if do |k, _|
columns.include? k
end
name = "host|#{column}"
dimensions = { host: host }
dimensions[column] = value
rollup(name, beginning, **dimensions)