Skip to main content

Squid log files

Plugin: go.d.plugin Module: squidlog

Overview

his collector monitors Squid servers by parsing their access log files.

It automatically detects log files of Squid severs running on localhost.

This collector is supported on all platforms.

This collector supports collecting metrics from multiple instances of this integration, including remote instances.

Default Behavior

Auto-Detection

This integration doesn't support auto-detection.

Limits

The default configuration for this integration does not impose any limits on data collection.

Performance Impact

The default configuration for this integration is not expected to impose a significant performance impact on the system.

Metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

Per Squid log files instance

These metrics refer to the entire monitored application.

This scope has no labels.

Metrics:

MetricDimensionsUnit
squidlog.requestsrequestsrequests/s
squidlog.excluded_requestsunmatchedrequests/s
squidlog.type_requestssuccess, bad, redirect, errorrequests/s
squidlog.http_status_code_class_responses1xx, 2xx, 3xx, 4xx, 5xxresponses/s
squidlog.http_status_code_responsesa dimension per HTTP response coderesponses/s
squidlog.bandwidthsentkilobits/s
squidlog.response_timemin, max, avgmilliseconds
squidlog.uniq_clientsclientsclients
squidlog.cache_result_code_requestsa dimension per cache result coderequests/s
squidlog.cache_result_code_transport_tag_requestsa dimension per cache result delivery transport tagrequests/s
squidlog.cache_result_code_handling_tag_requestsa dimension per cache result handling tagrequests/s
squidlog.cache_code_object_tag_requestsa dimension per cache result produced object tagrequests/s
squidlog.cache_code_load_source_tag_requestsa dimension per cache result load source tagrequests/s
squidlog.cache_code_error_tag_requestsa dimension per cache result error tagrequests/s
squidlog.http_method_requestsa dimension per HTTP methodrequests/s
squidlog.mime_type_requestsa dimension per MIME typerequests/s
squidlog.hier_code_requestsa dimension per hierarchy coderequests/s
squidlog.server_address_forwarded_requestsa dimension per server addressrequests/s

Alerts

There are no alerts configured by default for this integration.

Setup

Prerequisites

No action required.

Configuration

File

The configuration file name for this integration is go.d/squidlog.conf.

You can edit the configuration file using the edit-config script from the Netdata config directory.

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config go.d/squidlog.conf

Options

Squid log format codes.

Squidlog is aware how to parse and interpret the following codes:

fieldsquid format codedescription
resp_time%trResponse time (milliseconds).
client_address%>aClient source IP address.
client_address%>AClient FQDN.
cache_code%SsSquid request status (TCP_MISS etc).
http_code%>HsThe HTTP response status code from Content Gateway to client.
resp_size%<stTotal size of reply sent to client (after adaptation).
req_method%rmRequest method (GET/POST etc).
hier_code%ShSquid hierarchy status (DEFAULT_PARENT etc).
server_address%<aServer IP address of the last server or peer connection.
server_address%<AServer FQDN or peer name.
mime_type%mtMIME content type.

In addition, to make Squid native log format csv parsable, squidlog understands these groups of codes:

fieldsquid format codedescription
result_code%Ss/%>HsCache code and http code.
hierarchy%Sh/%<aHierarchy code and server address.
Config options
NameDescriptionDefaultRequired
update_everyData collection frequency.1no
autodetection_retryRecheck interval in seconds. Zero means no recheck will be scheduled.0no
pathPath to the Squid access log file./var/log/squid/access.logyes
exclude_pathPath to exclude.*.gzno
parserLog parser configuration.no
parser.log_typeLog parser type.autono
parser.csv_configCSV log parser config.no
parser.csv_config.delimiterCSV field delimiter.spaceno
parser.csv_config.formatCSV log format.- $resp_time $client_address $result_code $resp_size $req_method - - $hierarchy $mime_typeyes
parser.ltsv_configLTSV log parser config.no
parser.ltsv_config.field_delimiterLTSV field delimiter.\tno
parser.ltsv_config.value_delimiterLTSV value delimiter.:no
parser.ltsv_config.mappingLTSV fields mapping to known fields.yes
parser.regexp_configRegExp log parser config.no
parser.regexp_config.patternRegExp pattern with named groups.yes
parser.log_type

Weblog supports 3 different log parsers:

Parser typeDescription
csvA comma-separated values
ltsvLTSV
regexpRegular expression with named groups

Syntax:

parser:
log_type: csv
parser.csv_config.format
parser.ltsv_config.mapping

The mapping is a dictionary where the key is a field, as in logs, and the value is the corresponding known field.

Note: don't use $ and % prefixes for mapped field names.

parser:
log_type: ltsv
ltsv_config:
mapping:
label1: field1
label2: field2
parser.regexp_config.pattern

Use pattern with subexpressions names. These names should be known fields.

Note: don't use $ and % prefixes for mapped field names.

Syntax:

parser:
log_type: regexp
regexp_config:
pattern: PATTERN

Examples

There are no configuration examples.

Troubleshooting

Debug Mode

Important: Debug mode is not supported for data collection jobs created via the UI using the Dyncfg feature.

To troubleshoot issues with the squidlog collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    cd /usr/libexec/netdata/plugins.d/
  • Switch to the netdata user.

    sudo -u netdata -s
  • Run the go.d.plugin to debug the collector:

    ./go.d.plugin -d -m squidlog

Getting Logs

If you're encountering problems with the squidlog collector, follow these steps to retrieve logs and identify potential issues:

  • Run the command specific to your system (systemd, non-systemd, or Docker container).
  • Examine the output for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem.

System with systemd

Use the following command to view logs generated since the last Netdata service restart:

journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep squidlog

System without systemd

Locate the collector log file, typically at /var/log/netdata/collector.log, and use grep to filter for collector's name:

grep squidlog /var/log/netdata/collector.log

Note: This method shows logs from all restarts. Focus on the latest entries for troubleshooting current issues.

Docker Container

If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:

docker logs netdata 2>&1 | grep squidlog

Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.