Categories
DevOps

How to inspect consul configuration

Inspect consul configuration using command-line utilities.

Display debugging information.

$ consul info
agent:
	check_monitors = 0
	check_ttls = 0
	checks = 0
	services = 0
build:
	prerelease = 
	revision = 19041f20
	version = 1.12.2
	version_metadata = 
consul:
	acl = enabled
	bootstrap = false
	known_datacenters = 1
	leader = false
	leader_addr = 
	server = true
raft:
	applied_index = 65554
	commit_index = 0
	fsm_pending = 0
	last_contact = never
	last_log_index = 80560
	last_log_term = 76946
	last_snapshot_index = 65554
	last_snapshot_term = 6421
	latest_configuration = [{Suffrage:Voter ID:823bfd36-3d11-15cc-02cf-70eb7230b37b Address:172.16.148.11:8300} {Suffrage:Voter ID:bd2d2d9c-cd48-c65e-60f8-5f81a100a858 Address:172.16.148.12:8300}]
	latest_configuration_index = 0
	num_peers = 1
	protocol_version = 3
	protocol_version_max = 3
	protocol_version_min = 0
	snapshot_version_max = 1
	snapshot_version_min = 0
	state = Candidate
	term = 76984
runtime:
	arch = amd64
	cpu_count = 2
	goroutines = 86
	max_procs = 2
	os = linux
	version = go1.18.1
serf_lan:
	coordinate_resets = 0
	encrypted = true
	event_queue = 0
	event_time = 19
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 8402
	members = 3
	query_queue = 0
	query_time = 9
serf_wan:
	coordinate_resets = 0
	encrypted = true
	event_queue = 0
	event_time = 1
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 3224
	members = 3
	query_queue = 0
	query_time = 3

Display detailed configuration using local API.

$ curl  "http://127.0.0.1:8500/v1/agent/self?pretty"
{
    "Config": {
        "Datacenter": "dc-lab-1",
        "PrimaryDatacenter": "dc-lab-1",
        "NodeName": "consul-2",
        "NodeID": "bd2d2d9c-cd48-c65e-60f8-5f81a100a858",
        "Revision": "19041f20",
        "Server": true,
        "Version": "1.12.2"
    },
    "DebugConfig": {
        "ACLEnableKeyListPolicy": false,
        "ACLInitialManagementToken": "hidden",
        "ACLResolverSettings": {
            "ACLDefaultPolicy": "deny",
            "ACLDownPolicy": "extend-cache",
            "ACLPolicyTTL": "30s",
            "ACLRoleTTL": "0s",
            "ACLTokenTTL": "30s",
            "ACLsEnabled": true,
            "Datacenter": "dc-lab-1",
            "EnterpriseMeta": {},
            "NodeName": "consul-2"
        },
        "ACLTokenReplication": false,
        "ACLTokens": {
            "ACLAgentRecoveryToken": "hidden",
            "ACLAgentToken": "hidden",
            "ACLDefaultToken": "hidden",
            "ACLReplicationToken": "hidden",
            "DataDir": "/opt/consul",
            "EnablePersistence": true,
            "EnterpriseConfig": {}
        },
        "ACLsEnabled": true,
        "AEInterval": "1m0s",
        "AdvertiseAddrLAN": "172.16.148.12",
        "AdvertiseAddrWAN": "172.16.148.12",
        "AdvertiseReconnectTimeout": "0s",
        "AllowWriteHTTPFrom": [],
        "AutoConfig": {
            "Authorizer": {
                "AllowReuse": false,
                "AuthMethod": {
                    "ACLAuthMethodEnterpriseFields": {},
                    "Config": {
                        "BoundAudiences": null,
                        "BoundIssuer": "",
                        "ClaimMappings": null,
                        "ClockSkewLeeway": 0,
                        "ExpirationLeeway": 0,
                        "JWKSCACert": "",
                        "JWKSURL": "",
                        "JWTSupportedAlgs": null,
                        "JWTValidationPubKeys": null,
                        "ListClaimMappings": null,
                        "NotBeforeLeeway": 0,
                        "OIDCDiscoveryCACert": "",
                        "OIDCDiscoveryURL": ""
                    },
                    "Description": "",
                    "DisplayName": "",
                    "EnterpriseMeta": {},
                    "MaxTokenTTL": "0s",
                    "Name": "Auto Config Authorizer",
                    "RaftIndex": {
                        "CreateIndex": 0,
                        "ModifyIndex": 0
                    },
                    "TokenLocality": "",
                    "Type": "jwt"
                },
                "ClaimAssertions": [],
                "Enabled": false
            },
            "DNSSANs": [],
            "Enabled": false,
            "IPSANs": [],
            "IntroToken": "hidden",
            "IntroTokenFile": "",
            "ServerAddresses": []
        },
        "AutoEncryptAllowTLS": true,
        "AutoEncryptDNSSAN": [],
        "AutoEncryptIPSAN": [],
        "AutoEncryptTLS": false,
        "AutoReloadConfig": false,
        "AutoReloadConfigCoalesceInterval": "1s",
        "AutopilotCleanupDeadServers": true,
        "AutopilotDisableUpgradeMigration": false,
        "AutopilotLastContactThreshold": "200ms",
        "AutopilotMaxTrailingLogs": 250,
        "AutopilotMinQuorum": 0,
        "AutopilotRedundancyZoneTag": "",
        "AutopilotServerStabilizationTime": "10s",
        "AutopilotUpgradeVersionTag": "",
        "BindAddr": "0.0.0.0",
        "Bootstrap": false,
        "BootstrapExpect": 3,
        "Cache": {
            "EntryFetchMaxBurst": 2,
            "EntryFetchRate": 1.7976931348623157e+308,
            "Logger": null
        },
        "CheckDeregisterIntervalMin": "1m0s",
        "CheckOutputMaxSize": 4096,
        "CheckReapInterval": "30s",
        "CheckUpdateInterval": "5m0s",
        "Checks": [],
        "ClientAddrs": [
            "0.0.0.0"
        ],
        "ConfigEntryBootstrap": [],
        "ConnectCAConfig": {},
        "ConnectCAProvider": "",
        "ConnectEnabled": true,
        "ConnectMeshGatewayWANFederationEnabled": false,
        "ConnectServerlessPluginEnabled": false,
        "ConnectSidecarMaxPort": 21255,
        "ConnectSidecarMinPort": 21000,
        "ConnectTestCALeafRootChangeSpread": "0s",
        "ConsulCoordinateUpdateBatchSize": 128,
        "ConsulCoordinateUpdateMaxBatches": 5,
        "ConsulCoordinateUpdatePeriod": "5s",
        "ConsulRaftElectionTimeout": "5s",
        "ConsulRaftHeartbeatTimeout": "5s",
        "ConsulRaftLeaderLeaseTimeout": "2.5s",
        "ConsulServerHealthInterval": "2s",
        "DNSARecordLimit": 0,
        "DNSAddrs": [
            "tcp://0.0.0.0:8600",
            "udp://0.0.0.0:8600"
        ],
        "DNSAllowStale": true,
        "DNSAltDomain": "",
        "DNSCacheMaxAge": "0s",
        "DNSDisableCompression": false,
        "DNSDomain": "consul.",
        "DNSEnableTruncate": false,
        "DNSMaxStale": "87600h0m0s",
        "DNSNodeMetaTXT": true,
        "DNSNodeTTL": "0s",
        "DNSOnlyPassing": false,
        "DNSPort": 8600,
        "DNSRecursorStrategy": "sequential",
        "DNSRecursorTimeout": "2s",
        "DNSRecursors": [],
        "DNSSOA": {
            "Expire": 86400,
            "Minttl": 0,
            "Refresh": 3600,
            "Retry": 600
        },
        "DNSServiceTTL": {},
        "DNSUDPAnswerLimit": 3,
        "DNSUseCache": false,
        "DataDir": "/opt/consul",
        "Datacenter": "dc-lab-1",
        "DefaultQueryTime": "5m0s",
        "DevMode": false,
        "DisableAnonymousSignature": false,
        "DisableCoordinates": false,
        "DisableHTTPUnprintableCharFilter": false,
        "DisableHostNodeID": true,
        "DisableKeyringFile": false,
        "DisableRemoteExec": true,
        "DisableUpdateCheck": false,
        "DiscardCheckOutput": false,
        "DiscoveryMaxStale": "0s",
        "EnableAgentTLSForChecks": false,
        "EnableCentralServiceConfig": true,
        "EnableDebug": false,
        "EnableLocalScriptChecks": true,
        "EnableRemoteScriptChecks": false,
        "EncryptKey": "hidden",
        "EnterpriseRuntimeConfig": {},
        "ExposeMaxPort": 21755,
        "ExposeMinPort": 21500,
        "GRPCAddrs": [],
        "GRPCPort": -1,
        "GossipLANGossipInterval": "200ms",
        "GossipLANGossipNodes": 3,
        "GossipLANProbeInterval": "1s",
        "GossipLANProbeTimeout": "500ms",
        "GossipLANRetransmitMult": 4,
        "GossipLANSuspicionMult": 4,
        "GossipWANGossipInterval": "500ms",
        "GossipWANGossipNodes": 3,
        "GossipWANProbeInterval": "5s",
        "GossipWANProbeTimeout": "3s",
        "GossipWANRetransmitMult": 4,
        "GossipWANSuspicionMult": 6,
        "HTTPAddrs": [
            "tcp://0.0.0.0:8500"
        ],
        "HTTPBlockEndpoints": [],
        "HTTPMaxConnsPerClient": 200,
        "HTTPMaxHeaderBytes": 0,
        "HTTPPort": 8500,
        "HTTPResponseHeaders": {},
        "HTTPSAddrs": [],
        "HTTPSHandshakeTimeout": "5s",
        "HTTPSPort": -1,
        "HTTPUseCache": true,
        "KVMaxValueSize": 524288,
        "LeaveDrainTime": "5s",
        "LeaveOnTerm": false,
        "Logging": {
            "EnableSyslog": false,
            "LogFilePath": "/var/log/consul/",
            "LogJSON": false,
            "LogLevel": "info",
            "LogRotateBytes": 0,
            "LogRotateDuration": "0s",
            "LogRotateMaxFiles": 0,
            "Name": "",
            "SyslogFacility": "LOCAL0"
        },
        "MaxQueryTime": "10m0s",
        "NodeID": "bd2d2d9c-cd48-c65e-60f8-5f81a100a858",
        "NodeMeta": {},
        "NodeName": "consul-2",
        "PidFile": "",
        "PrimaryDatacenter": "dc-lab-1",
        "PrimaryGateways": [],
        "PrimaryGatewaysInterval": "30s",
        "RPCAdvertiseAddr": "tcp://172.16.148.12:8300",
        "RPCBindAddr": "tcp://0.0.0.0:8300",
        "RPCConfig": {
            "EnableStreaming": true
        },
        "RPCHandshakeTimeout": "5s",
        "RPCHoldTimeout": "7s",
        "RPCMaxBurst": 1000,
        "RPCMaxConnsPerClient": 100,
        "RPCProtocol": 2,
        "RPCRateLimit": -1,
        "RaftBoltDBConfig": {
            "NoFreelistSync": false
        },
        "RaftProtocol": 3,
        "RaftSnapshotInterval": "30s",
        "RaftSnapshotThreshold": 16384,
        "RaftTrailingLogs": 10240,
        "ReadReplica": false,
        "ReconnectTimeoutLAN": "0s",
        "ReconnectTimeoutWAN": "0s",
        "RejoinAfterLeave": false,
        "RetryJoinIntervalLAN": "30s",
        "RetryJoinIntervalWAN": "30s",
        "RetryJoinLAN": [
            "172.16.148.11",
            "172.16.148.12",
            "172.16.148.13"
        ],
        "RetryJoinMaxAttemptsLAN": 0,
        "RetryJoinMaxAttemptsWAN": 0,
        "RetryJoinWAN": [],
        "Revision": "19041f20",
        "SegmentLimit": 64,
        "SegmentName": "",
        "SegmentNameLimit": 64,
        "Segments": [],
        "SerfAdvertiseAddrLAN": "tcp://172.16.148.12:8301",
        "SerfAdvertiseAddrWAN": "tcp://172.16.148.12:8302",
        "SerfAllowedCIDRsLAN": [],
        "SerfAllowedCIDRsWAN": [],
        "SerfBindAddrLAN": "tcp://0.0.0.0:8301",
        "SerfBindAddrWAN": "tcp://0.0.0.0:8302",
        "SerfPortLAN": 8301,
        "SerfPortWAN": 8302,
        "ServerMode": true,
        "ServerName": "",
        "ServerPort": 8300,
        "Services": [],
        "SessionTTLMin": "0s",
        "SkipLeaveOnInt": true,
        "StartJoinAddrsLAN": [],
        "StartJoinAddrsWAN": [],
        "StaticRuntimeConfig": {
            "EncryptVerifyIncoming": true,
            "EncryptVerifyOutgoing": true
        },
        "SyncCoordinateIntervalMin": "15s",
        "SyncCoordinateRateTarget": 64,
        "TLS": {
            "AutoTLS": false,
            "Domain": "consul.",
            "EnableAgentTLSForChecks": false,
            "GRPC": {
                "CAFile": "/etc/consul.d/consul-agent-ca.pem",
                "CAPath": "",
                "CertFile": "/etc/consul.d/dc1-server-consul-0.pem",
                "CipherSuites": [],
                "KeyFile": "hidden",
                "TLSMinVersion": "TLSv1_2",
                "VerifyIncoming": true,
                "VerifyOutgoing": false,
                "VerifyServerHostname": false
            },
            "HTTPS": {
                "CAFile": "/etc/consul.d/consul-agent-ca.pem",
                "CAPath": "",
                "CertFile": "/etc/consul.d/dc1-server-consul-0.pem",
                "CipherSuites": [],
                "KeyFile": "hidden",
                "TLSMinVersion": "TLSv1_2",
                "VerifyIncoming": true,
                "VerifyOutgoing": true,
                "VerifyServerHostname": false
            },
            "InternalRPC": {
                "CAFile": "/etc/consul.d/consul-agent-ca.pem",
                "CAPath": "",
                "CertFile": "/etc/consul.d/dc1-server-consul-0.pem",
                "CipherSuites": [],
                "KeyFile": "hidden",
                "TLSMinVersion": "TLSv1_2",
                "VerifyIncoming": true,
                "VerifyOutgoing": true,
                "VerifyServerHostname": true
            },
            "NodeName": "consul-2",
            "ServerName": ""
        },
        "TaggedAddresses": {
            "lan": "172.16.148.12",
            "lan_ipv4": "172.16.148.12",
            "wan": "172.16.148.12",
            "wan_ipv4": "172.16.148.12"
        },
        "Telemetry": {
            "AllowedPrefixes": [],
            "BlockedPrefixes": [
                "consul.rpc.server.call"
            ],
            "CirconusAPIApp": "",
            "CirconusAPIToken": "hidden",
            "CirconusAPIURL": "",
            "CirconusBrokerID": "",
            "CirconusBrokerSelectTag": "",
            "CirconusCheckDisplayName": "",
            "CirconusCheckForceMetricActivation": "",
            "CirconusCheckID": "",
            "CirconusCheckInstanceID": "",
            "CirconusCheckSearchTag": "",
            "CirconusCheckTags": "",
            "CirconusSubmissionInterval": "",
            "CirconusSubmissionURL": "",
            "Disable": false,
            "DisableCompatOneNine": true,
            "DisableHostname": false,
            "DogstatsdAddr": "",
            "DogstatsdTags": [],
            "FilterDefault": true,
            "MetricsPrefix": "consul",
            "PrometheusOpts": {
                "CounterDefinitions": [],
                "Expiration": "0s",
                "GaugeDefinitions": [],
                "Name": "consul",
                "Registerer": null,
                "SummaryDefinitions": []
            },
            "RetryFailedConfiguration": true,
            "StatsdAddr": "",
            "StatsiteAddr": ""
        },
        "TranslateWANAddrs": false,
        "TxnMaxReqLen": 524288,
        "UIConfig": {
            "ContentPath": "/ui/",
            "DashboardURLTemplates": {},
            "Dir": "",
            "Enabled": true,
            "HCPEnabled": false,
            "MetricsProvider": "",
            "MetricsProviderFiles": [],
            "MetricsProviderOptionsJSON": "",
            "MetricsProxy": {
                "AddHeaders": [],
                "BaseURL": "",
                "PathAllowlist": []
            }
        },
        "UnixSocketGroup": "",
        "UnixSocketMode": "",
        "UnixSocketUser": "",
        "UseStreamingBackend": true,
        "Version": "1.12.2",
        "VersionMetadata": "",
        "VersionPrerelease": "",
        "Watches": []
    },
    "Coord": {
        "Vec": [
            0.0001062966342015243,
            0.0001997657843255835,
            0.00015887551171547942,
            0.00028242739749137095,
            -0.000034945970171756664,
            0.00021239565971046203,
            0.00003166489390997381,
            0.0002119136222056268
        ],
        "Error": 0.045651834232260845,
        "Adjustment": 0.000037927751961373836,
        "Height": 0.00013358046168881444
    },
    "Member": {
        "Name": "consul-2",
        "Addr": "172.16.148.12",
        "Port": 8301,
        "Tags": {
            "acls": "1",
            "build": "1.12.2:19041f20",
            "dc": "dc-lab-1",
            "expect": "3",
            "ft_fs": "1",
            "ft_si": "1",
            "id": "bd2d2d9c-cd48-c65e-60f8-5f81a100a858",
            "port": "8300",
            "raft_vsn": "3",
            "role": "consul",
            "segment": "",
            "use_tls": "1",
            "vsn": "2",
            "vsn_max": "3",
            "vsn_min": "2",
            "wan_join_port": "8302"
        },
        "Status": 1,
        "ProtocolMin": 1,
        "ProtocolMax": 5,
        "ProtocolCur": 2,
        "DelegateMin": 2,
        "DelegateMax": 5,
        "DelegateCur": 4
    },
    "Stats": {
        "agent": {
            "check_monitors": "0",
            "check_ttls": "0",
            "checks": "0",
            "services": "0"
        },
        "build": {
            "prerelease": "",
            "revision": "19041f20",
            "version": "1.12.2",
            "version_metadata": ""
        },
        "consul": {
            "acl": "enabled",
            "bootstrap": "false",
            "known_datacenters": "1",
            "leader": "false",
            "leader_addr": "",
            "server": "true"
        },
        "raft": {
            "applied_index": "65554",
            "commit_index": "0",
            "fsm_pending": "0",
            "last_contact": "never",
            "last_log_index": "80560",
            "last_log_term": "76946",
            "last_snapshot_index": "65554",
            "last_snapshot_term": "6421",
            "latest_configuration": "[{Suffrage:Voter ID:823bfd36-3d11-15cc-02cf-70eb7230b37b Address:172.16.148.11:8300} {Suffrage:Voter ID:bd2d2d9c-cd48-c65e-60f8-5f81a100a858 Address:172.16.148.12:8300}]",
            "latest_configuration_index": "0",
            "num_peers": "1",
            "protocol_version": "3",
            "protocol_version_max": "3",
            "protocol_version_min": "0",
            "snapshot_version_max": "1",
            "snapshot_version_min": "0",
            "state": "Candidate",
            "term": "76987"
        },
        "runtime": {
            "arch": "amd64",
            "cpu_count": "2",
            "goroutines": "86",
            "max_procs": "2",
            "os": "linux",
            "version": "go1.18.1"
        },
        "serf_lan": {
            "coordinate_resets": "0",
            "encrypted": "true",
            "event_queue": "0",
            "event_time": "19",
            "failed": "0",
            "health_score": "0",
            "intent_queue": "0",
            "left": "0",
            "member_time": "8402",
            "members": "3",
            "query_queue": "0",
            "query_time": "9"
        },
        "serf_wan": {
            "coordinate_resets": "0",
            "encrypted": "true",
            "event_queue": "0",
            "event_time": "1",
            "failed": "0",
            "health_score": "0",
            "intent_queue": "0",
            "left": "0",
            "member_time": "3224",
            "members": "3",
            "query_queue": "0",
            "query_time": "3"
        }
    },
    "Meta": {
        "consul-network-segment": ""
    }
}

Extract useful information using jq utility.

$ curl --silent  "http://127.0.0.1:8500/v1/agent/self?pretty" | jq -r '.DebugConfig.RetryJoinLAN[]'
172.16.148.11
172.16.148.12
172.16.148.13