Keen documentation
Open Keen ↗

Using Keen

Build and preview evidence mappings

Chapter 4 of 17

Mapping made simple

This chapter teaches the one skill that makes Keen useful: turning a real event into a rule that links evidence to controls. Start here if the words action, outcome or mapping feel abstract. The sections that follow show the full editor, then how to keep rules healthy as evidence keeps arriving.

A mapping rule says: “When an event looks like this, link it to these controls.” Begin with an event you can already see in Keen. Its fields tell you which words go in the rule.

QuestionKeen fieldExample recorded value
Where did it come from?Sourcejenkins
Which service or server?Systemprod
What happened?Action / activitybuild
What was the result?Outcome / resultsuccess
Who did it?ActorAn account name, when provided

Action is the activity name already written on the event, and Outcome is the result already written there. Filling either field in a rule asks Keen to find events with that value.

  1. Open Admin → Sources & evidence mapping → New mapping. Describe what the evidence demonstrates, such as “Production build checks completed successfully.”
  2. Select the source and, if relevant, its specific job, query, feed or page. Choose a recent event.
  3. Choose Copy its match values. Keen fills in the system, activity and result from that event. Remove any value you want to allow to vary.
  4. Read the sentence below the fields. For this example it should say: Jenkins events with activity build and result success. Keep system prod only if that is the event's recorded system.
  5. Select the controls or clauses this evidence supports. One event can link to several controls and frameworks.
  6. Preview the matches. Look at both the matching events and the explanations for events that did not match. Publish when those examples reflect your intention.
Both activity and result must match before this rule links the event to its chosen controls.
Both activity and result must match before this rule links the event to its chosen controls.
Diagram source (Mermaid)
flowchart TB
  E["Jenkins records a build"] --> A{"Activity equals build?"}
  A -->|Yes| O{"Result equals success?"}
  A -->|No| K["Keep the event without this rule's mapping"]
  O -->|No| K
  O -->|Yes| M["Link evidence to the selected controls"]
  M --> R["Review evidence and assess the requirement"]
  K --> X["Other rules can still match"]
Open full-size diagram
Four rules of matching
  • An empty optional field means any value is allowed.
  • Every filled condition must match: action build plus outcome success needs both.
  • Text is case-sensitive: Build and build are different values.
  • Severity is an exact number: 4 means severity 4.

Suggested values come from recent evidence, so they are examples of what that source has recently produced. With no recent evidence, collect a sample first. The advanced Predefine option is for sources whose values you already know.

Going deeper: what each source calls its activities and results
SourceTypical activityResult to expectWhat to check
Jenkinsbuild, or the configured job kindsuccess, failed, infoFAILURE, ABORTED and UNSTABLE become failed.
RSSpublished or updatedinfoA published item is information; evaluate its relevance to the control.
Keen Agentpackage.upgrade, auditd.SYSCALL, http.requestDepends on the parser: info, success or failureA package log may report an action without claiming success. Inspect the actual event.
Loki / CloudWatchThe collection's configured activityThe collection's configured resultThe query must select records that justify those assigned values.
Guided API integrationA mapped API field or configured constantA mapped result, optionally translatedPreview the normalized event before creating its mapping rule.

Keep the exact word the source supplies: Jenkins failed and agent failure are different values. info means an informational record with no success or failure claim. A blank Outcome can be useful for linking all maintenance activity, including records that need further review.

Collection and mapping are two steps. Collection settings decide which records enter Keen and the fields they carry. Mapping conditions read those fields and decide where to link the evidence. Change field extraction in the integration editor; change control links in sources & evidence mapping.

A mapping records a relationship; the judgement is yours. When you assess the requirement, weigh relevance, time period, scope and quality. A failed check can itself be useful evidence of monitoring or incident handling, with its failed result kept visible.

Configure collection and mapping with evidence definitions

Step 2 of an evidence definition: name what the evidence demonstrates, then add the controls it supports; suggestions come from the name you typed.
Step 2 of an evidence definition: name what the evidence demonstrates, then add the controls it supports; suggestions come from the name you typed.

The full editor is in Admin → Sources & evidence mapping. An evidence definition combines three things: a source input, the events from it that count as evidence, and the controls or clauses they support. One input can feed several definitions, and one event can support several frameworks.

Choose Create evidence definition to open the four-step editor.

  1. Describe the evidence. Say what the collected evidence demonstrates, such as successful production deployments following the change process.
  2. Collect and recognise. Select the source adapter and input type, then an existing query, job, feed or page, or create a collection item. Inspect a Recent event with Use this event, then narrow the definition with event fields if needed. All events from this source suits a deliberately source-wide definition.
  3. Select framework controls or clauses. The list starts on the framework selected in the navigation bar. Pick a framework and a target, and use Add for each further target, including targets in other frameworks. The selected target is also included when you choose Next; check the complete list.
  4. Preview and save. Choose Preview matches and inspect both matches and non-matches. Set the confidence and enabled state under Advanced rule settings, then Save rule.

Prefer source, system, actor, action, outcome, severity or label values you can see on real events, and keep regex for patterns exact values cannot express. The description-based control suggestions are candidates for you to review. Confidence is your own mapping confidence between 0 and 1; compliance is assessed through evidence and review.

Collection settings and credentials

A Jenkins job's kind becomes the event action and its label the event system. For Loki, configure the query and its normalised event fields. For BookStack, select a book and then a page, grouped by chapter, using the picker's page-loading buttons when needed; the picker uses the server's configured credentials.

Additional collection settings takes connector-specific JSON options, and Shared adapter settings holds advanced options common to an adapter. Neither is a place for secrets: connection credentials and adapter enablement are server settings for the hosting operator.

Read mapping preview results

Preview compares the rule with recent events. Green Matches entries show the event and its proposed framework targets; amber Does not match entries explain why an event was excluded. Labels accompany the colours. Adjust the conditions and preview again before saving.

Step 3: Preview matches shows which recent events the rule matches and explains, for each non-match, which condition failed.
Step 3: Preview matches shows which recent events the rule matches and explains, for each non-match, which condition failed.

While a source type is paused in the source catalogue, its existing evidence stays available for review and mapping.

Definitions before events arrive

Select Predefine this rule before evidence is available when there is no sample to preview. As soon as collection runs, preview the definition against the first real events and correct any assumption about field values or collection identity.

Build and verify an evidence definition

Three words describe the pieces. An adapter connects to a service. A collection item is one input from it: a query, job, feed, project or page. An evidence definition says which events from that input support which controls. Reuse collection items when several definitions share an input.

Step 1: pick a real event and copy its match values, then narrow the rule with a structured field condition.
Step 1: pick a real event and copy its match values, then narrow the rule with a structured field condition.

The checklist below is the same editor, walked through with verification in mind.

  1. Choose Create evidence definition and describe the claim: for example, “Successful production deployments recorded by the approved deployment job.”
  2. In Collect and recognise, select the adapter and input type and choose or create the collection item. Use All events from this source only when every input from that adapter belongs.
  3. Use Recent event → Use this event to read the actual normalised fields. Keep the exact values, including distinctions such as “deploy” and “deployment”.
  4. Fill the relevant source, system, actor, action, outcome, severity or label conditions. Start with exact values.
  5. Add each target framework, control or clause to the list and check the references.
  6. Preview a positive sample and an event that should not qualify. Make sure another collection item, a failed outcome or an unrelated environment cannot match by accident.
  7. Review the enabled state, the confidence and whether to apply the rule to existing evidence. Save, and watch any background job separately from the save itself.

Example. If the inspected event says system “production-api”, action “deployment” and outcome “success”, those three conditions restrict the definition to successful deployments of that system. A failed deployment deserves its own definition or an incident investigation; sharing the success mapping because both events came from Jenkins would blur the evidence.

Historical evidence and changing rules

Rules change, and evidence already collected should follow. Apply saved rule to past evidence runs a background job that reconciles the automatic mappings this rule owns: it adds matching controls and removes links to controls you removed from the rule, including links on events that no longer match.

What stays untouched: manual and imported mappings, links still supported by another active rule, and older mappings whose rule ownership is uncertain. When the job finishes, reopen an event to review its controls.

Going deeper: remapping a wider range

Admin → Sources & evidence mapping → Evidence mapping → Remap old events supports a wider operation with source and time filters. Its normal mode finds unmapped events; Include already-mapped events permits additive mappings. Begin with a bounded range and inspect the results.

Apply rules to existing evidence

In the rule editor, Apply this rule to previously collected evidence in the background is selected by default; review it before saving. Saving the definition and finishing the background job are separate events, and the job reports its own status. You can also run Apply saved rule to past evidence on a saved rule at any time.

Admin → Remap is the broader tool, with date, limit, source, system, action and outcome filters. By default it processes events with no mappings; Include already-mapped events adds new rule-based mappings to events already linked elsewhere. Adding mappings is a different operation from removing stale ones.

Going deeper: version conflicts and revision history

If another administrator saved a newer configuration, reload it and reconcile the two versions before saving. Restore this rule's revision is available for a saved rule: its history starts at revision 1 for that rule, ignores edits to other rules, changes only the selected rule, keeps collection settings and other rules, and does not remap historical evidence. Deleting a definition keeps its historical mappings.

Create a mapping from an event

The quickest way to a good rule starts from the event page. Everything the rule needs is already on the screen.

  1. Open an event and choose Create mapping from this event.
  2. Review the suggested conditions. Field names follow the event JSON, including structured keys such as fields → process.name, fields → host.name, fields → status and fields → log.file.path.
  3. Remove conditions that are too specific. A host or IP condition restricts the rule to that host or address, and event identifiers and timestamps each identify a single record.
  4. Give the mapping a meaningful name and choose the framework controls or clauses. The suggestion button uses the name to find relevant controls; refine the name and try again if the suggestions miss.
  5. Review and save. The existing-mapping browser lets you search, edit or delete rules, and the historical-application action maps evidence already collected.

A mapping attributes matching evidence to framework requirements. Collection inputs decide which remote data Keen fetches; a rule on its own does not configure a remote collection.