Skip to main content
added 57 characters in body; edited tags
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

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. Can 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) {

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!

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. 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!

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!

Source Link

How can I use sed\awk to look for certain lines within a file, and then match all subsequent lines that match a different pattern?

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. 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!