# Fluentd configuration for LittleShop log aggregation @type tail path /fluentd/log/*.log pos_file /fluentd/log/littleshop.log.pos tag littleshop.logs format json time_key timestamp time_format %Y-%m-%d %H:%M:%S refresh_interval 5 @type record_transformer hostname "#{Socket.gethostname}" service "littleshop" environment "production" # Parse structured logs @type parser key_name message reserve_data true @type regexp expression /^\[(?\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (?\w{3})\] (?.*?)( (?\{.*\}))?$/ time_key timestamp time_format %Y-%m-%d %H:%M:%S # Route logs based on severity @type copy # Store all logs in file @type file path /fluentd/log/output/littleshop append true time_slice_format %Y%m%d time_slice_wait 10m time_format %Y-%m-%d %H:%M:%S compress gzip @type file path /fluentd/log/buffer/littleshop flush_mode interval flush_interval 30s chunk_limit_size 10MB queue_limit_length 32 retry_type exponential_backoff retry_wait 1s retry_max_interval 60s retry_max_times 3 # Send critical errors to separate file @type file path /fluentd/log/output/littleshop-errors append true time_slice_format %Y%m%d time_slice_wait 10m time_format %Y-%m-%d %H:%M:%S compress gzip @type grep key level pattern /^(ERR|FATAL|ERROR|Exception)/i @type file path /fluentd/log/buffer/littleshop-errors flush_mode interval flush_interval 10s chunk_limit_size 5MB queue_limit_length 16 # System metrics @type monitor_agent bind 0.0.0.0 port 24220