That helped me some Michael.
I have made a complete regex for my ssl_request_log and i am able to use these fields.
counter apache_http_requests_total by request_method, http_version, response_code
counter apache_http_bytes_total by request_method, http_version, response_code
counter apache_http_ip_total by request_method, http_version, IP
counter apache_http_endpoint_total by request_method, http_version, endpoint
/^(?P<IP>\d+\.\d+\.\d+\.\d+)\ +(?P<hostname>[0-9A-Za-z-\.]+)\ +-\ +-\ +\[(?P<timestamp>\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} \+\d{4})\]\ +(?P<tls_version>TLSv\d\.\d)\ +(?P<cipher>[0-9A-Za-z-]+)\ +\"(?P<request_method>[A-Z]+)\ +(?P<endpoint>[A-Za-z\/_\.]+)\ +(?P<http_version>HTTP\/\d\.\d)\"\ +(?P<response_code>\d{3})\ +(?P<response_size>[\d-]+)\ +(?P<time_to_serve>\d+)\ +\"(?P<url>[0-9A-Za-z-\.:?=\/_&+]+)\"\ +\"(?P<browser>[0-9A-Za-z-\.:?=\/_;\(\) ]+)\"\ +\"(?P<stat1>[\w-]+)\"\ +\"(?P<stat2>[\w-]+)\"/ {
apache_http_requests_total[$request_method][$http_version][$response_code]++
$response_size > 0 {
apache_http_bytes_total[$request_method][$http_version][$response_code] += $response_size
apache_http_ip_total[$request_method][$http_version][$IP]++
apache_http_endpoint_total[$request_method][$http_version][$endpoint]++
}
}
So that is working.
Now i'm left with the question how to most simply use a mtail prog to scan for text in different files with different setups.
I now have this:
counter ERROR_in_log by log_file
counter WARN_in_log by log_file
counter API_Inc_in_log by log_file
counter total_hits_in_log by log_file
/(.*)/ {
$1 =~ /ERROR/ {
ERROR_in_log[getfilename()]++
}
$1 =~ /WARN/ {
WARN_in_log[getfilename()]++
}
$1 =~ /Incoming API request from/ {
API_Inc_in_log[getfilename()]++
}
total_hits_in_log[getfilename()]++
}
But i think it can be better streamlined....
Also i suspect if a logline has ERROR and WARN in it the WARN is not counted.
So if i put in more elements some might be skipped.
Op donderdag 24 september 2020 om 13:52:43 UTC+2 schreef Michael Ströder: