github.com/netdata/go.d.plugin@v0.58.1/modules/squidlog/integrations/squid_log_files.md (about)

     1  <!--startmeta
     2  custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/squidlog/README.md"
     3  meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/squidlog/metadata.yaml"
     4  sidebar_label: "Squid log files"
     5  learn_status: "Published"
     6  learn_rel_path: "Data Collection/Web Servers and Web Proxies"
     7  most_popular: True
     8  message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
     9  endmeta-->
    10  
    11  # Squid log files
    12  
    13  
    14  <img src="https://netdata.cloud/img/squid.png" width="150"/>
    15  
    16  
    17  Plugin: go.d.plugin
    18  Module: squidlog
    19  
    20  <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
    21  
    22  ## Overview
    23  
    24  his collector monitors Squid servers by parsing their access log files.
    25  
    26  
    27  It automatically detects log files of Squid severs running on localhost.
    28  
    29  
    30  This collector is supported on all platforms.
    31  
    32  This collector supports collecting metrics from multiple instances of this integration, including remote instances.
    33  
    34  
    35  ### Default Behavior
    36  
    37  #### Auto-Detection
    38  
    39  This integration doesn't support auto-detection.
    40  
    41  #### Limits
    42  
    43  The default configuration for this integration does not impose any limits on data collection.
    44  
    45  #### Performance Impact
    46  
    47  The default configuration for this integration is not expected to impose a significant performance impact on the system.
    48  
    49  
    50  ## Metrics
    51  
    52  Metrics grouped by *scope*.
    53  
    54  The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
    55  
    56  
    57  
    58  ### Per Squid log files instance
    59  
    60  These metrics refer to the entire monitored application.
    61  
    62  This scope has no labels.
    63  
    64  Metrics:
    65  
    66  | Metric | Dimensions | Unit |
    67  |:------|:----------|:----|
    68  | squidlog.requests | requests | requests/s |
    69  | squidlog.excluded_requests | unmatched | requests/s |
    70  | squidlog.type_requests | success, bad, redirect, error | requests/s |
    71  | squidlog.http_status_code_class_responses | 1xx, 2xx, 3xx, 4xx, 5xx | responses/s |
    72  | squidlog.http_status_code_responses | a dimension per HTTP response code | responses/s |
    73  | squidlog.bandwidth | sent | kilobits/s |
    74  | squidlog.response_time | min, max, avg | milliseconds |
    75  | squidlog.uniq_clients | clients | clients |
    76  | squidlog.cache_result_code_requests | a dimension per cache result code | requests/s |
    77  | squidlog.cache_result_code_transport_tag_requests | a dimension per cache result delivery transport tag | requests/s |
    78  | squidlog.cache_result_code_handling_tag_requests | a dimension per cache result handling tag | requests/s |
    79  | squidlog.cache_code_object_tag_requests | a dimension per cache result produced object tag | requests/s |
    80  | squidlog.cache_code_load_source_tag_requests | a dimension per cache result load source tag | requests/s |
    81  | squidlog.cache_code_error_tag_requests | a dimension per cache result error tag | requests/s |
    82  | squidlog.http_method_requests | a dimension per HTTP method | requests/s |
    83  | squidlog.mime_type_requests | a dimension per MIME type | requests/s |
    84  | squidlog.hier_code_requests | a dimension per hierarchy code | requests/s |
    85  | squidlog.server_address_forwarded_requests | a dimension per server address | requests/s |
    86  
    87  
    88  
    89  ## Alerts
    90  
    91  There are no alerts configured by default for this integration.
    92  
    93  
    94  ## Setup
    95  
    96  ### Prerequisites
    97  
    98  No action required.
    99  
   100  ### Configuration
   101  
   102  #### File
   103  
   104  The configuration file name for this integration is `go.d/squidlog.conf`.
   105  
   106  
   107  You can edit the configuration file using the `edit-config` script from the
   108  Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory).
   109  
   110  ```bash
   111  cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
   112  sudo ./edit-config go.d/squidlog.conf
   113  ```
   114  #### Options
   115  
   116  Squid [log format codes](http://www.squid-cache.org/Doc/config/logformat/).
   117  
   118  Squidlog is aware how to parse and interpret the following codes:
   119  
   120  | field          | squid format code | description                                                   |
   121  |----------------|-------------------|---------------------------------------------------------------|
   122  | resp_time      | %tr               | Response time (milliseconds).                                 |
   123  | client_address | %>a               | Client source IP address.                                     |
   124  | client_address | %>A               | Client FQDN.                                                  |
   125  | cache_code     | %Ss               | Squid request status (TCP_MISS etc).                          |
   126  | http_code      | %>Hs              | The HTTP response status code from Content Gateway to client. |
   127  | resp_size      | %<st              | Total size of reply sent to client (after adaptation).        |
   128  | req_method     | %rm               | Request method (GET/POST etc).                                |
   129  | hier_code      | %Sh               | Squid hierarchy status (DEFAULT_PARENT etc).                  |
   130  | server_address | %<a               | Server IP address of the last server or peer connection.      |
   131  | server_address | %<A               | Server FQDN or peer name.                                     |
   132  | mime_type      | %mt               | MIME content type.                                            |
   133  
   134  In addition, to make `Squid` [native log format](https://wiki.squid-cache.org/Features/LogFormat#Squid_native_access.log_format_in_detail) csv parsable, squidlog understands these groups of codes:
   135  
   136  | field       | squid format code | description                        |
   137  |-------------|-------------------|------------------------------------|
   138  | result_code | %Ss/%>Hs          | Cache code and http code.          |
   139  | hierarchy   | %Sh/%<a           | Hierarchy code and server address. |
   140  
   141  
   142  <details><summary>Config options</summary>
   143  
   144  | Name | Description | Default | Required |
   145  |:----|:-----------|:-------|:--------:|
   146  | update_every | Data collection frequency. | 1 | no |
   147  | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no |
   148  | path | Path to the Squid access log file. | /var/log/squid/access.log | yes |
   149  | exclude_path | Path to exclude. | *.gz | no |
   150  | parser | Log parser configuration. |  | no |
   151  | parser.log_type | Log parser type. | auto | no |
   152  | parser.csv_config | CSV log parser config. |  | no |
   153  | parser.csv_config.delimiter | CSV field delimiter. | space | no |
   154  | parser.csv_config.format | CSV log format. | - $resp_time $client_address $result_code $resp_size $req_method - - $hierarchy $mime_type | yes |
   155  | parser.ltsv_config | LTSV log parser config. |  | no |
   156  | parser.ltsv_config.field_delimiter | LTSV field delimiter. | \t | no |
   157  | parser.ltsv_config.value_delimiter | LTSV value delimiter. | : | no |
   158  | parser.ltsv_config.mapping | LTSV fields mapping to **known fields**. |  | yes |
   159  | parser.regexp_config | RegExp log parser config. |  | no |
   160  | parser.regexp_config.pattern | RegExp pattern with named groups. |  | yes |
   161  
   162  ##### parser.log_type
   163  
   164  Weblog supports 3 different log parsers:
   165  
   166  | Parser type | Description                               |
   167  |-------------|-------------------------------------------|
   168  | csv         | A comma-separated values                  |
   169  | ltsv        | [LTSV](http://ltsv.org/)                  |
   170  | regexp      | Regular expression with named groups      |
   171  
   172  Syntax:
   173  
   174  ```yaml
   175  parser:
   176    log_type: csv
   177  ```
   178  
   179  
   180  ##### parser.csv_config.format
   181  
   182  
   183  
   184  ##### parser.ltsv_config.mapping
   185  
   186  The mapping is a dictionary where the key is a field, as in logs, and the value is the corresponding **known field**.
   187  
   188  > **Note**: don't use `$` and `%` prefixes for mapped field names.
   189  
   190  ```yaml
   191  parser:
   192    log_type: ltsv
   193    ltsv_config:
   194      mapping:
   195        label1: field1
   196        label2: field2
   197  ```
   198  
   199  
   200  ##### parser.regexp_config.pattern
   201  
   202  Use pattern with subexpressions names. These names should be **known fields**.
   203  
   204  > **Note**: don't use `$` and `%` prefixes for mapped field names.
   205  
   206  Syntax:
   207  
   208  ```yaml
   209  parser:
   210    log_type: regexp
   211    regexp_config:
   212      pattern: PATTERN
   213  ```
   214  
   215  
   216  </details>
   217  
   218  #### Examples
   219  There are no configuration examples.
   220  
   221  
   222  
   223  ## Troubleshooting
   224  
   225  ### Debug Mode
   226  
   227  To troubleshoot issues with the `squidlog` collector, run the `go.d.plugin` with the debug option enabled. The output
   228  should give you clues as to why the collector isn't working.
   229  
   230  - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
   231    your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
   232  
   233    ```bash
   234    cd /usr/libexec/netdata/plugins.d/
   235    ```
   236  
   237  - Switch to the `netdata` user.
   238  
   239    ```bash
   240    sudo -u netdata -s
   241    ```
   242  
   243  - Run the `go.d.plugin` to debug the collector:
   244  
   245    ```bash
   246    ./go.d.plugin -d -m squidlog
   247    ```
   248  
   249