When several fleets of Docker hosts forward data into the same Splunk, tag each fleet’s data at the source so you can tell the fleets apart in the dashboards. To show each team only its own data, separate the data into indexes and let Splunk’s roles enforce it.
Without a tag, every dashboard turns into a guessing game: which environment is this container running in, and which team owns it?
Identifying the clusters
Identify the cluster with the configuration
The simplest tag is a cluster name. Set it once on each collectorfordocker container, and every event from that fleet carries it:
1--env "COLLECTOR__CLUSTER=general__fields.docker_cluster=-"For example, on a development fleet:
1--env "COLLECTOR__CLUSTER=general__fields.docker_cluster=development"ACL for Clusters
When different teams should see different data, push the separation down to Splunk indexes and let Splunk’s role system enforce it. Every search in the app runs through macros, so once the indexes are wired up, the macros do the rest.
For example, take three groups of users, each with its own view of the fleets:
- Admins see Production and Development across the board.
- Team1 sees only the containers its team builds.
- Team2 sees only its own.
To set it up:
- Define six indexes, one default per environment plus one per team per environment:
docker_prod_team1docker_prod_team2docker_proddocker_dev_team1docker_dev_team2docker_dev
- Create two HEC tokens:
- The Production token defaults to
docker_prodand is allowed to write todocker_prod_team1anddocker_prod_team2. - The Development token defaults to
docker_devand is allowed to write todocker_dev_team1anddocker_dev_team2.
- The Production token defaults to
- Use the Production token on Docker hosts in the production environment, and the Development token on hosts in the development environment.
- Label the containers Team1 and Team2 build with container annotations that redirect each team’s data into its index for that environment:
docker_prod_team1anddocker_prod_team2in production,docker_dev_team1anddocker_dev_team2in development. - On the Splunk side, change the macros to search across
index=docker_*. - Create three roles:
- Admins, with access to every index;
- Team1, with access to
docker_prod_team1anddocker_dev_team1; - Team2, with access to
docker_prod_team2anddocker_dev_team2.
The same dashboards now show different data depending on who’s logged in. Team1 and Team2 see only logs and metrics from their own containers, while Admins see everything, system-level data included.