Specifying log delivery using the Amazon CLI - Amazon ElastiCache for Redis
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Specifying log delivery using the Amazon CLI

Slow Log

Create a replication group with slow log delivery to CloudWatch Logs.

For Linux, OS X, or Unix:

aws elasticache create-replication-group \ --replication-group-id test-slow-log \ --replication-group-description test-slow-log \ --engine redis \ --cache-node-type cache.r5.large \ --num-cache-clusters 2 \ --log-delivery-configurations '{ "LogType":"slow-log", "DestinationType":"cloudwatch-logs", "DestinationDetails":{ "CloudWatchLogsDetails":{ "LogGroup":"my-log-group" } }, "LogFormat":"json" }'

For Windows:

aws elasticache create-replication-group ^ --replication-group-id test-slow-log ^ --replication-group-description test-slow-log ^ --engine redis ^ --cache-node-type cache.r5.large ^ --num-cache-clusters 2 ^ --log-delivery-configurations '{ "LogType":"slow-log", "DestinationType":"cloudwatch-logs", "DestinationDetails":{ "CloudWatchLogsDetails":{ "LogGroup":"my-log-group" } }, "LogFormat":"json" }'

Modify a replication group to deliver slow log to CloudWatch Logs

For Linux, OS X, or Unix:

aws elasticache modify-replication-group \ --replication-group-id test-slow-log \ --apply-immediately \ --log-delivery-configurations ' { "LogType":"slow-log", "DestinationType":"cloudwatch-logs", "DestinationDetails":{ "CloudWatchLogsDetails":{ "LogGroup":"my-log-group" } }, "LogFormat":"json" }'

For Windows:

aws elasticache modify-replication-group ^ --replication-group-id test-slow-log ^ --apply-immediately ^ --log-delivery-configurations ' { "LogType":"slow-log", "DestinationType":"cloudwatch-logs", "DestinationDetails":{ "CloudWatchLogsDetails":{ "LogGroup":"my-log-group" } }, "LogFormat":"json" }'

Modify a replication group to disable slow log delivery

For Linux, OS X, or Unix:

aws elasticache modify-replication-group \ --replication-group-id test-slow-log \ --apply-immediately \ --log-delivery-configurations ' { "LogType":"slow-log", "Enabled":false }'

For Windows:

aws elasticache modify-replication-group ^ --replication-group-id test-slow-log ^ --apply-immediately ^ --log-delivery-configurations ' { "LogType":"slow-log", "Enabled":false }'

Engine Log

Create a replication group with engine log delivery to CloudWatch Logs.

For Linux, OS X, or Unix:

aws elasticache create-replication-group \ --replication-group-id test-slow-log \ --replication-group-description test-slow-log \ --engine redis \ --cache-node-type cache.r5.large \ --num-cache-clusters 2 \ --log-delivery-configurations '{ "LogType":"engine-log", "DestinationType":"cloudwatch-logs", "DestinationDetails":{ "CloudWatchLogsDetails":{ "LogGroup":"my-log-group" } }, "LogFormat":"json" }'

For Windows:

aws elasticache create-replication-group ^ --replication-group-id test-slow-log ^ --replication-group-description test-slow-log ^ --engine redis ^ --cache-node-type cache.r5.large ^ --num-cache-clusters 2 ^ --log-delivery-configurations '{ "LogType":"engine-log", "DestinationType":"cloudwatch-logs", "DestinationDetails":{ "CloudWatchLogsDetails":{ "LogGroup":"my-log-group" } }, "LogFormat":"json" }'

Modify a replication group to deliver engine log to Kinesis Data Firehose

For Linux, OS X, or Unix:

aws elasticache modify-replication-group \ --replication-group-id test-slow-log \ --apply-immediately \ --log-delivery-configurations ' { "LogType":"engine-log", "DestinationType":"kinesis-firehose", "DestinationDetails":{ "KinesisFirehoseDetails":{ "DeliveryStream":"test" } }, "LogFormat":"json" }'

For Windows:

aws elasticache modify-replication-group ^ --replication-group-id test-slow-log ^ --apply-immediately ^ --log-delivery-configurations ' { "LogType":"engine-log", "DestinationType":"kinesis-firehose", "DestinationDetails":{ "KinesisFirehoseDetails":{ "DeliveryStream":"test" } }, "LogFormat":"json" }'

Modify a replication group to switch to engine format

For Linux, OS X, or Unix:

aws elasticache modify-replication-group \ --replication-group-id test-slow-log \ --apply-immediately \ --log-delivery-configurations ' { "LogType":"engine-log", "LogFormat":"json" }'

For Windows:

aws elasticache modify-replication-group ^ --replication-group-id test-slow-log ^ --apply-immediately ^ --log-delivery-configurations ' { "LogType":"engine-log", "LogFormat":"json" }'

Modify a replication group to disable engine log delivery

For Linux, OS X, or Unix:

aws elasticache modify-replication-group \ --replication-group-id test-slow-log \ --apply-immediately \ --log-delivery-configurations ' { "LogType":"engine-log", "Enabled":false }'

For Windows:

aws elasticache modify-replication-group ^ --replication-group-id test-slow-log ^ --apply-immediately ^ --log-delivery-configurations ' { "LogType":"engine-log", "Enabled":false }'