# netdata go.d.plugin configuration for web_log
#
# This file is in YAML format. Generally the format is:
#
# name: value
#
# There are 2 sections:
#  - GLOBAL
#  - JOBS
#
#
# [ GLOBAL ]
# These variables set the defaults for all JOBs, however each JOB may define its own, overriding the defaults.
#
# The GLOBAL section format:
# param1: value1
# param2: value2
#
# Currently supported global parameters:
#  - update_every
#    Data collection frequency in seconds. Default: 1.
#
#  - autodetection_retry
#    Re-check interval in seconds. Attempts to start the job are made once every interval.
#    Zero means not to schedule re-check. Default: 0.
#
#  - priority
#    Priority is the relative priority of the charts as rendered on the web page,
#    lower numbers make the charts appear before the ones with higher numbers. Default: 70000.
#
#
# [ JOBS ]
# JOBS allow you to collect values from multiple sources.
# Each source will have its own set of charts.
#
# IMPORTANT:
#  - Parameter 'name' is mandatory.
#  - Jobs with the same name are mutually exclusive. Only one of them will be allowed running at any time.
#
# This allows auto detection to try several alternatives and pick the one that works.
# Any number of jobs is supported.
#
# The JOBS section format:
#
# jobs:
#   - name: job1
#     param1: value1
#     param2: value2
#
#   - name: job2
#     param1: value1
#     param2: value2
#
#   - name: job2
#     param1: value1
#
#
# [ List of JOB specific parameters ]:
#  - path
#    The path to web server log file, can use wildcard.
#    Syntax:
#      path: /path/to/log/file
#      path: /path/to/log/*.log
#
#  - exclude_path
#    The path to be excluded, can use wildcard.
#    Syntax:
#      exclude_path: *.tar.gz
#
#  - url_patterns
#    Requests per URL pattern chart. Matches against URL field.
#    Matcher pattern syntax: https://github.com/netdata/go.d.plugin/tree/master/pkg/matcher#supported-format
#    Syntax:
#      url_patterns:
#        - name:  name1    # Name will be used as dimension.
#          match: pattern  # Pattern syntax: matcher.
#        - name:  name2
#          match: pattern
#
#  - custom_fields
#    Requests per pattern charts. Matches against <custom> fields. Used in custom log format.
#    Matcher pattern syntax: https://github.com/netdata/go.d.plugin/tree/master/pkg/matcher#supported-format
#    Syntax:
#      custom_fields:
#        - name:  field_name1  # Field name. Should match field name from log format.
#          patterns:
#          - name:  name1      # Name will be used as dimension.
#            match: pattern    # Pattern syntax: matcher.
#          - name:  name2
#            match: pattern
#        - name:  field_name2
#          patterns:
#          - name:  name1
#            match: pattern
#          - name:  name2
#            match: pattern
#
#  - custom_time_fields
#    Count min/avg/max and also cumulative histogram for defined custom time fields like apache LogIOTrackTTFB. Used in custom log format.
#    Syntax:
#      custom_time_fields:
#        - name:  field_name1  # Field name. Should match field name from log format.
#          histogram: [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10] # optional field
#        - name:  field_name2
#          histogram: [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10]
#
#  - histogram
#    Cumulative histogram of response time in seconds.
#    Syntax:
#      histogram: [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10]
#
#  - group_response_codes
#    Group response codes by code class (informational, successful, redirects, client and server errors).
#    Syntax:
#      group_response_codes: yes/no
#
#  - log_type
#    One of supported log types: csv, ltsv, regexp, auto.
#    If set to auto module will try to auto-detect log type and format.
#    Auto-detection order: ltsv, csv.
#    Syntax:
#      log_type: auto/csv/ltsv/regexp
#
#  - csv_config
#    CSV log type specific parameters.
#    Syntax:
#    csv_config:
#      format: 'format'            # Defines log format. You need define nginx or apache log format.
#                                    Nginx: http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
#                                    Apache: http://httpd.apache.org/docs/current/mod/mod_log_config.html
#      fields_per_record: -1       # The number of expected fields per record. If set to positive, csv parser requires
#                                    each record to have the given number of fields. If set to 0, csv parser sets it to
#                                    the number of fields in the first record, so that future records must have the same
#                                    field count. If fields_per_record is negative, no check is made and records may have
#                                    a variable number of fields.
#      delimiter: ' '              # Field delimiter.
#      trim_leading_space: yes/no  # If set to true, leading white space in a field is ignored.
#
#  - ltsv_config
#    LTSV log type specific parameters.
#    Syntax:
#    ltsv_config:
#      field_delimiter: ' '  # Fields delimiter.
#      value_delimiter: ':'  # Label-value pairs delimiter.
#      mapping:              # Label field mapping.
#        label1: field1
#        label2: field2
#
#  - json_config
#    JSON log type specific parameters.
#    Syntax:
#    json_config:
#      mapping:              # Label field mapping, json-log-label: weblog-label
#        label1: field1
#        label2: field2
#
#  - regexp_config
#    RegExp log type specific parameters.
#    Pattern syntax: https://golang.org/pkg/regexp/syntax/.
#    Syntax:
#    regexp_config:
#      pattern: pattern  # Pattern. It is mandatory to have subexpressions names in the pattern.
#
#
# [ JOB defaults ]:
#  exclude_path: *.gz
#  group_response_codes: yes
#  log_type: auto
#  csv_config:
#    fields_per_record: -1
#    delimiter: ' '
#    trim_leading_space: no
#  ltsv_config:
#      field_delimiter: '   '
#      value_delimiter: ':'
#
#
# [ JOB mandatory parameters ]:
#  - name
#  - path
#
# ------------------------------------------------MODULE-CONFIGURATION--------------------------------------------------

# update_every: 1
# autodetection_retry: 0
# priority: 70000

jobs:
  # NGINX
  # debian, arch
  - name: nginx
    path: /var/log/nginx/access.log

  # gentoo
  - name: nginx
    path: /var/log/nginx/localhost.access_log

  # APACHE
  # debian
  - name: apache
    path: /var/log/apache2/access.log

  # gentoo
  - name: apache
    path: /var/log/apache2/access_log

  # arch
  - name: apache
    path: /var/log/httpd/access_log

  # debian
  - name: apache_vhosts
    path: /var/log/apache2/other_vhosts_access.log

  # GUNICORN
  - name: gunicorn
    path: /var/log/gunicorn/access.log

  - name: gunicorn
    path: /var/log/gunicorn/gunicorn-access.log

  # IIS
  # This configuration assumes you are running netdata on WSL
  - name: iis
    path: /mnt/c/inetpub/logs/LogFiles/W3SVC1/u_ex*.log
    log_type: csv
    csv_config:
      format: '- - $host $request_method $request_uri - $server_port - $remote_addr - - $status - - $request_time'
