I have found a similar topic but could not figure out how to implement it for my own use:
grab multiple lines after a matching target line
Here's the issue:
I'm trying to implement it on a project of my own but can't seem to make it work. I am using Linux, can someone break it down?
Basically what I'm trying to do is go through a log bundle and capture specific lines along with their stack\details. Here's an example:
2020-01-20T05:58:19.119Z verbose vpxa[6E21B70] [Originator@6876 sub=PropertyProvider opID=k5cokp1a-928316-auto-jwal-h5:70047736-92-01-84] [CommitChangesAndNotify] Updating cached values
2020-01-20T05:58:19.119Z info vpxa[6E21B70] [Originator@6876 sub=Default opID=k5cokp1a-928316-auto-jwal-h5:70047736-92-01-84] [VpxLRO] -- ERROR task-107599 -- **vm-1178** -- vim.VirtualMachine.reconfigure: vmodl.fault.InvalidArgument:
--> Result:
--> (vmodl.fault.InvalidArgument) {
--> faultCause = (vmodl.MethodFault) null,
--> faultMessage = (vmodl.LocalizableMessage) [
--> (vmodl.LocalizableMessage) {
--> key = "msg.disk.extendFailure",
--> arg = (vmodl.KeyAnyValue) [
--> (vmodl.KeyAnyValue) {
I'll want to capture every line that contains "vm-1178" and all subsequent lines that start with "-->" until the pattern changes, then start looking for vm-1178 until the next time this occurs, etc.
Hope it makes sense. Thanks!
-->
? – AdminBee Apr 14 '20 at 11:17