Posts

Showing posts from February, 2025

Log rotation demo with Systemd Unit

System Units To demonstrate log rotation using logrotate and helps to understand systemD unit creation and apply compute resoruce(memory/CPU) to specific cgroup. Create script that generates logs /home/scripts/script_logrotate.sh #!/bin/bash # https://redis.io/docs/latest/develop/use/patterns/bulk-loading/ # Set the number of keys to generate num_keys=2000 # Set the size of the value for each key (in bytes) # 1MB , with k and v, -> 2MB value_size=64 # create logs dir mkdir -p /home/scripts/logs/ # Set the output file name output_file="/home/scripts/logs/redis-data.log" # Generate data and write to file for i in $(seq 1 $num_keys); do # Generate a random string of the specified size value=$(head -c $value_size /dev/urandom | tr -dc A-Za-z0-9 | head -c $value_size) # Create the Redis SET command redis_command1="SET key$i \"$value\"" # Append the command to the output file echo "$redis_command1" ...