#Tail and parse arbitrary text/log file @type tail #Parse timestamp, everything else to be stored in message field @type regexp expression /^\[(?[^\]]*)\] (?.*)$/ time_key logtime time_format %Y-%m-%d %H:%M:%S %z path /var/log/backend-app*.log pos_file /var/log/backend.application.pos path_key filename # Add watched file path to path_key field for every event/record. tag backend.application #Add hostname and service_name fields to all events ("records") with a Fluentd tag of backend.application @type record_transformer hostname "#{Socket.gethostname}" service_name ${tag} # For all events with a tag of backend.application: # Keep ONLY events where service_name field contains a value matching /backend.application/ AND where message field contains a value matching /Cannot connect to/ # Discard any events where value of hostname field matches /staging/ @type grep key service_name pattern /backend.application/ key message pattern /Cannot connect to/ key hostname pattern /staging/ #Write events with backend.application tag to New Relic @type newrelic api_key