4 Commits

Author SHA1 Message Date
fauno 9d00fd4126 v0.7.2 2025-11-16 13:12:12 -03:00
fauno e1f899684a fix: prevent build failure 2025-11-16 13:11:44 -03:00
fauno db0406cec1 v0.7.1 2025-11-16 12:58:26 -03:00
fauno 56ddd6c250 fix: spanish typo 2025-11-16 12:58:06 -03:00
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: "access_log"
version: "0.7.0"
version: "0.7.2"
authors:
- "f <f@sutty.nl>"
targets:
+8 -8
View File
@@ -14,7 +14,7 @@ require "./swd"
require "./asn"
require "./presence"
VERSION = "0.7.0"
VERSION = "0.7.2"
Log.setup_from_env
@@ -29,7 +29,7 @@ crawler = false
ai_bot = false
# Parse the crawlers repository
crawlers = [] of Crawler
ai_bots = IaBots.new
ai_bots = AiBots.new
# Fields in database
# TODO: Obtain them from AccessLog
fields = %w[id remote_user host msec server_protocol request_method request_completion uri request_uri query_string status sent_http_content_type sent_http_content_encoding sent_http_etag sent_http_last_modified http_accept http_accept_encoding http_accept_language http_pragma http_cache_control http_if_none_match http_dnt http_user_agent http_origin http_referer request_time bytes_sent body_bytes_sent request_length http_connection pipe connection_requests geoip2_data_country_name geoip2_data_city_name ssl_server_name ssl_protocol ssl_early_data ssl_session_reused ssl_curves ssl_ciphers ssl_cipher sent_http_x_xss_protection sent_http_x_frame_options sent_http_x_content_type_options sent_http_strict_transport_security nginx_version pid crawler datacenter_co2 network_co2 consumer_device_co2 production_co2 total_co2 node asn http3 http_sec_fetch_mode http_sec_fetch_dest http_sec_fetch_site http_sec_fetch_user http_sec_purpose limit_req_status limit_conn_status ai_bot]
@@ -72,10 +72,10 @@ OptionParser.parse do |p|
crawlers = Array(Crawler).from_json File.read(c)
end
p.on "-i ai-robots.json", "--ia-bots ai-robots.json", "AI bots repository" do |c|
p.on "-i ai-robots.json", "--ai-bots ai-robots.json", "AI bots repository" do |c|
crawler = true
ai_bot = true
ai_bots = IaBots.from_json File.read(c)
ai_bots = AiBots.from_json File.read(c)
end
p.on "-s /tmp/access_log.socket", "--socket /tmp/access_log.socket", "Listening socket" do |s|
@@ -125,11 +125,11 @@ query = "insert into access_logs (#{fields.join(",")}) values (#{params.join(","
# regex.
if crawler
crawler_re = Regex.union(crawlers.map { |c| c.pattern })
end
if ai_bots
ai_bot_re = Regex.union(ai_bots.keys)
crawler_re = Regex.union(crawler_re, ai_bot_re)
if ai_bots
ai_bot_re = Regex.union(ai_bots.keys)
crawler_re = Regex.union(crawler_re, ai_bot_re)
end
end
def remove_socket!(socket)