Instead of writing a rather complex regex, it would probably be easier to write a different one for each pattern, e.g.
props.conf
EXTRACT-foo = \[audit\s(?<src_user>\S+)\sas\s(?<dst_user>\S+)\son
EXTRACT-bill = \son\s(?<console>pts[^\]]+)\]
EXTRACT-bob = \son\s(?<src_ip>[\d.]+):(?<src_port>\d+)-\>(?<dst_ip>[\d.]+):(?<dst_port>\d+)\]
EXTRACT-jim = \]\s(?<path>/\S+)\s(?<command>.*)
EXTRACT-joe = \]:\s\#===\ssession\s(?<session_status>\w+)
EXTRACT-hoss = \s\on\s(?<origin>\S+)\]
EXTRACT-hank = \s\S+\][^:]*:\s(?<action>.*)
This means that not all fields will be present in all events, e.g. src_port etc, and that some extractions will overlap.
The extraction named foo will handle the things that are common to all events, whereas bill and bob will deal with the alternate versions of pts * and ip/port pairs.
jim and joe deal with the different actions (sessions and commands executed). Finally hank & hoss extracts jim/joe and bill/bob information, regardless of format for easier reporting.
Consider this as examples of an approach, rather than The One Way To Do It.
/K
... View more