I'm trying to extract this line from my linux logs in splunk using rex but I'm not sure how to extract it
TCP 220.127.116.11:80 -> 10.10.50.26:100
Can you post a sample of your raw data line and what you need extracted? for your question, it isn't clear, if you want one variable to extract the entire phrase or if you want to extract fields from the pasted line.
You could try this:
index=_internal| head 1| eval _raw="TCP 18.104.22.168:80 -> 10.10.50.26:100"| rex "TCP\s+(?<src>[^:]+):(?<src_port>[^\s]+)\s+->\s+(?<dst>[^:]+):(?<dst_port>[^\s]+)"