Query:
index = test
| stats values(*) as * by ip_addr, location
| where location="USA"
| fields timestamp, user, ip, location, message
Result:
+--------------------------------------------------------------------+
| timestamp | user | ip | location | message |
+--------------------------------------------------------------------+
| 08/08/2020 17:00 | thomas | 10.10.10.10 | USA | Hello, world!|
| 08/08/2020 17:05. | unknown| | | I love steak!|
| 08/08/2020 17:10. | | | | I love soda! |
+--------------------------------------------------------------------+
| 08/08/2020 17:00 | jeffry | 10.10.10.20 | USA | Hello, world!|
| 08/08/2020 17:35 | unknown| | | I love pancke|
| 08/08/2020 17:40 | | | | I love waffle|
+--------------------------------------------------------------------+
I want to:
- make those multiple timestamps become one single timestamp
- remove the "unknown" value in the "user" field
- make "message" field to display only the "Hello, world!" - I dont care about the rest.
I tried to do:
index = test
| stats values(*) as * by ip_addr
| where location="USA"
| eval user=replace(user, "unknown", "")
| fields timestamp, user, ip, location, message
But it removes all the values under "user" field. Any advice? My number 2 and number 3 goals look similar. If I could crack either one of them, I think I could solve the other one easily.