Streaming Docker Objects from the API
Starting with version 5.9
you can poll objects from the Docker API server to Splunk. This is useful if you want to
build your own alerts for configurations, that you expect from images and containers.
Configuration
In the configuration for the collectorfordocker you can find pre-configured polling for the containers and images, which are disabled by default
[input.docker_api::containers] # disable docker events disabled = true path = /containers/json inspectPath = /containers/{{.Id}}/json interval = 5m query = all=1 apiVersion = # override type type = docker_objects # specify Splunk index index = # set output (splunk or devnull, default is [general]defaultOutput) output = [input.docker_api::images] # disable docker events disabled = true path = /images/json inspectPath = /images/{{.Id}}/json interval = 5m query = all=0 apiVersion = # override type type = docker_objects # specify Splunk index index = # set output (splunk or devnull, default is [general]defaultOutput) output =
To enable streaming of these objects, you can simple add environment variables to your collectorfordocker container
... --env "COLLECTOR__DOCKER_CONTAINERS=input.docker_api::containers__disabled=false" \ --env "COLLECTOR__DOCKER_IMAGES=input.docker_api::images__disabled=false" \ ...
Searching the data
With the configuration in the example above, the collectord will resend all the objects every 5 minutes.
If you are planning to run the join
command or populate the lookups, make sure that your
search command covers more than interval
, you can use for example 6 minutes
.
The source name
By default the source will be in the format /docker/{key}
, where key
is the path of the stanza [input.docker_api::{key}]
.
Event format
Containers are forwarded in the format provided by the api call /containers/{id}/json
and images in the format provided
by the api call /images/{id}/json
, see Engine API for details.
Searching the data
Considering that in the same time frame you can have the same object more than once (as an example if the object has been modified several times in 10 minutes), you need to group the objects by the unique identifier.
sourcetype="docker_objects" source="/docker/containers" | stats latest(_raw) as _raw by Id | spath output=Created path=Created | spath output=Name path=Name | spath output=Status path=State.Status | table Created, Name, Status
Links
-
Installation
- Start monitoring your docker environments in under 10 minutes.
- Automatically forward host, container and application logs.
- Test our solution with the embedded 30 days evaluation license.
-
Collector Configuration
- Collector configuration reference.
- Build custom image on top collector image with embedded configuration.
-
Container Annotations
- Forwarding application logs.
- Multi-line container logs.
- Fields extraction for application and container logs (including timestamp extractions).
- Hiding sensitive data, stripping terminal escape codes and colors.
-
Configuring Splunk Indexes
- Using not default HTTP Event Collector index.
- Configure the Splunk application to use not searchable by default indexes.
-
Splunk fields extraction for container logs
- Configure search-time fields extractions for container logs.
- Container logs source pattern.
-
Configurations for Splunk HTTP Event Collector
- Configure multiple HTTP Event Collector endpoints for Load Balancing and Fail-overs.
- Secure HTTP Event Collector endpoint.
- Configure the Proxy for HTTP Event Collector endpoint.
-
Collecting metrics from Prometheus format
- Configure collector to forward metrics from the services in Prometheus format.
-
Monitoring multiple clusters
- Learn how you can monitor multiple clusters.
- Learn how to set up ACL in Splunk.
-
Streaming Docker Objects from API Engine
- Learn how you can poll docker containers and images and forward them to Splunk.
-
License Server
- Learn how you can configure remote License URL for Collectord.
- Alerts
- Troubleshooting
- Release History
- Upgrade instructions
- Security
- FAQ and the common questions
- License agreement
- Pricing
- Contact