Skip to content
v2.275.0

JsonMutatorType Enum ​

Types of JSON mutation operations.

Defines operations that can be performed to modify the JSON structure of log events.

Example ​

ts

// Create a log group
const logGroup = new logs.LogGroup(this, 'MyLogGroup');

// Create a JSON parser processor
const jsonParser = new logs.ParserProcessor({
  type: logs.ParserProcessorType.JSON
});

// Create a processor to add keys
const addKeysProcessor = new logs.JsonMutatorProcessor({
  type: logs.JsonMutatorType.ADD_KEYS,
  addKeysOptions: {
    entries: [{
      key: 'metadata.transformed_in',
      value: 'CloudWatchLogs'
    }]
  }
});

// Create a transformer with these processors
new logs.Transformer(this, 'Transformer', {
  transformerName: 'MyTransformer',
  logGroup: logGroup,
  transformerConfig: [jsonParser, addKeysProcessor]
});

Members ​

MemberDescription
ADD_KEYSAdd new keys to the log event.
DELETE_KEYSDelete keys from the log event.
MOVE_KEYSMove keys to different locations.
RENAME_KEYSRename keys in the log event.
COPY_VALUECopy values between keys.
LIST_TO_MAPConvert a list to a map.

Referenced by ​