Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Json Config File

The config file is organized into the below sections.

SectionDescription
Docker ConfigThis section provides settings related to Docker.
Grafana ConfigThis section provides settings related to Grafana.
Observability ConfigThis section provides settings related to Metrics, Logs, and Traces for monitoring purposes.

Docker Config

This section provides settings related to connecting to the Docker daemon and which events should be published as Annotations to Grafana.

"Docker": {
    "Uri": "http://docker-proxy:2375",
    "ContainerEvents": [ "start", "stop", "restart" ],
    "ImageEvents": [],
    "PluginEvents": [],
    "VolumeEvents": [],
    "DaemonEvents": [],
    "ServiceEvents": [],
    "NodeEvents": [],
    "SecretEvents": [],
    "ConfigEvents": [],
  }
FieldRequiredDefaultDescription
Urinohttp://localhost:4243The full protocol, host, and port to connect to the docker daemon.
ContainerEventsno["start", "stop", "restart"]The list of Container events that should be recorded as annotations.
ImageEventsno[]The list of Image events that should be recorded as annotations.
PluginEventsno[]The list of Plugin events that should be recorded as annotations.
VolumeEventsno[]The list of Volume events that should be recorded as annotations.
DaemonEventsno[]The list of Daemon events that should be recorded as annotations.
ServiceEventsno[]The list of Service events that should be recorded as annotations.
NodeEventsno[]The list of Node events that should be recorded as annotations.
SecretEventsno[]The list of Secret events that should be recorded as annotations.
ConfigEventsno[]The list of Config events that should be recorded as annotations.

Grafana Config

This section provides settings related to connecting to Grafana.

"Grafana": {
    "ApiKey": "yourApiKey==",
    "Uri": "http://grafana:3000"
  },
FieldRequiredDefaultDescription
ApiKeyyesnullYour Grafana Api Token.
Urinohttp://grafana:3000The full protocol, host, and port to connect to Grafana.

Observability Config

DocGraf supports publishing OpenTelemetry Metrics, Logs, and Traces. This section provides settings related to those pillars.

The Observability config section contains three main sub-sections:

  1. Metrics - Metrics
  2. Jaeger - Traces
  3. Serilog - Logs
"Observability": {

    "Metrics": {
      "Enabled": false,
      "Port": 4000
    },

    "Tracing": {
      "Enabled": false,
      "Url": "http://localhost:4317"
    },

    "Serilog": {
      "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
      "MinimumLevel": "Information",
      "WriteTo": [
        { "Name": "Console" },
        {
          "Name": "File",
          "Args": {
            "path": "./output/log.txt",
            "rollingInterval": "Day",
            "retainedFileCountLimit": 7
          }
        }
      ]
    }
  }

Metrics Config

"Metrics": {
      "Enabled": false,
      "Port": 4000
    }
FieldRequiredDefaultDescription
EnablednofalseWhether or not to expose metrics. Metrics will be available at http://localhost:{port}/metrics
PortnofalseThe port the metrics endpoint should be served on.

If you are using Docker, ensure you have exposed the port from your container.

Example Metrics scraper config

- job_name: 'docgraf'
    scrape_interval: 60s
    static_configs:
      - targets: [<docgrafIPaddress>:<docgrafPort>]

Tracing Config

"Tracing": {
      "Enabled": false,
      "Url": "http://localhost:4317"
    }
FieldRequiredDefaultDescription
EnablednofalseWhether or not to generate traces.
Urlyes - if Enalbed=truenullThe host address for your trace collector. Traces are published using OTLP.

Serilog Config

"Serilog": {
      "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File",  "Serilog.Sinks.Grafana.Loki" ],
      "MinimumLevel": {
        "Default": "Information",
        "Override": {
          "Microsoft": "Error",
          "System": "Error"
        }
      },
      "WriteTo": [
        { "Name": "Console" },
        {
          "Name": "File",
          "Args": {
            "path": "./output/log.txt",
            "rollingInterval": "Day",
            "retainedFileCountLimit": 7
          }
        },
        {
          "Name": "GrafanaLoki",
          "Args": {
            "uri": "http://192.168.1.95:3100",
            "textFormatter": "Serilog.Sinks.Grafana.Loki.LokiJsonTextFormatter, Serilog.Sinks.Grafana.Loki",
            "labels": [
              {
                "key": "app",
                "value": "docgraf"
              }
            ]
          }
        }]
}
FieldRequiredDefaultDescription
UsingnonullA list of sinks you would like use. The valid sinks are listed in the examplea above.
MinimumLevelnonullThe minimum level to write. [Verbose, Debug, Information, Warning, Error, Fatal]
WriteTononullAdditional config for various sinks you are writing to.

More detailed information about configuring Logging can be found on the Serilog Config Repo.