I'm having no luck building a regex to match cs_usernames
. What I'm looking for are two separate searches both based on the
cs_username
field. The first search is to find all instances where the usernames are in all CAPS. The second search is to find usernames that end in at least two digits. Example of logs are below:
2020-05-15 04:58:34 10.140.14.228 POST /NotAvailable.aspx - 80 Gerardot 10.140.15.235 Mozilla/5.0+(Linux;+Android+9;+SM-G960U)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/74.0.3729.136+Mobile+Safari/537.36 302 0 0 15 172.69.69.111
2020-05-15 04:57:19 10.140.14.228 POST /Account/Login.aspx - 80 Kaitlyn1230 10.140.15.235 Mozilla/5.0+(iPhone;+CPU+iPhone+OS+13_4+like+Mac+OS+X)+AppleWebKit/605.1.15+(KHTML,+like+Gecko)+GSA/107.0.310639584+Mobile/15E148+Safari/604.1 200 0 0 46 162.158.75.109
2020-05-15 04:54:24 10.140.14.228 POST /PaymentInfo.aspx - 80 Emulbah 10.140.15.235 Mozilla/5.0+(Windows+NT+6.1;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/81.0.4044.138+Safari/537.36 302 0 0 46 172.68.150.39
Hi @Vfinney,
try the following regex
^\d+-\d+-\d+\s+\d+:\d+:\d+\s+\d+\.\d+\.\d+\.\d+\s+\w+\s\/[^ ]+\s+[^ ]+\s+\d+\s+(?<cs_username>[^ ]+)\s+
or using the rex command
your_search
| rex "^\d+-\d+-\d+\s+\d+:\d+:\d+\s+\d+\.\d+\.\d+\.\d+\s+\w+\s\/[^ ]+\s+[^ ]+\s+\d+\s+(?<cs_username>[^ ]+)\s+"
| ...
that you can test at https://regex101.com/r/xyPcQj/1
Ciao.
Giuseppe
Hi @Vfinney,
try the following regex
^\d+-\d+-\d+\s+\d+:\d+:\d+\s+\d+\.\d+\.\d+\.\d+\s+\w+\s\/[^ ]+\s+[^ ]+\s+\d+\s+(?<cs_username>[^ ]+)\s+
or using the rex command
your_search
| rex "^\d+-\d+-\d+\s+\d+:\d+:\d+\s+\d+\.\d+\.\d+\.\d+\s+\w+\s\/[^ ]+\s+[^ ]+\s+\d+\s+(?<cs_username>[^ ]+)\s+"
| ...
that you can test at https://regex101.com/r/xyPcQj/1
Ciao.
Giuseppe
your log is space delimited.
why do not you use \s
and \S
?
or try Field Extracter