Refine your search:

Hi all,

We have a system which always logs two lines, Eg:

1) Operation | Status | Time 2) Operation | Type

I want a search which would return all the second lines, where the first line Status is Failed. Eg. If I have these four logs, I want a search which returns only the 4th line (because the status of the operation is fail)

GET | SUCCESS | 100ms GET | type1

GET | FAIL | 1000ms GET | type1

Any ideas on how I can achieve this?

Thanks a lot!

asked 02 Mar '12, 05:02

simonattardGO's gravatar image

simonattardGO
917
accept rate: 0%


One Answer:

I'd extract the "type1" value as a field and then create a transaction.

... | transaction maxevents=2 startswith="GET | FAIL"

Alternatively if you have some kind of unique identifier that connects the two, using a subsearch is more efficient. Say your log looks more like this:

id592 | GET | FAIL | 1000ms
id592 | type1

Then you could extract the identifier (let's call the field "id") and the type1 value ("type") and do:

type=* [search "GET | FAIL" | fields id]
link

answered 02 Mar '12, 05:43

Ayn's gravatar image

Ayn
26.1k3717
accept rate: 41%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1,684
×13

Asked: 02 Mar '12, 05:02

Seen: 605 times

Last updated: 02 Mar '12, 05:43

Copyright © 2005-2012 Splunk Inc. All rights reserved.