VMware Cloud Community
GregSmid
Enthusiast
Enthusiast

Log insight query - return lines with text 'abcdef' plus the line immediately following it

Hi all,

Just wondering if anyone has tried anything like this before.  I'd like to find all lines that contain the text 'abcdef' (for example), plus the line that immediately follows that line.  Filtering for 'abcdef' is easy enough of course, but so far I've been having to check the timestamps on all those lines, clear the filter, and then manually find them based on timestamp to see the line that comes next. It's pretty tedious.

Would some sort of regex work maybe? I was thinking something like this:

abcdef((.*\n){2})

To me it seems like that should find the 'abcdef' string plus all characters after it, until it finds two new lines (the one at the end of the 'abcdef' line plus the new line at the end of the next line). Unfortunately, I can't seem to get any results back.

Anyone have any thoughts?

Thanks!

Greg

Tags (2)
Reply
0 Kudos
2 Replies
vmovsisyan
Enthusiast
Enthusiast

- quick workaround could be to export data, then grep

- maybe you could add this idea for the community to vote? http://loginsight.vmware.com/

a_nut_in
Expert
Expert

Just export the data and then grep -i "abcd" B5 or A5 etc

Example

Do remember to mark my post as "helpful" or "correct" if I've helped resolve or answer your query!
Reply
0 Kudos