Refine your search:

How i can get the string between two given strings.

Log has entires like

22:09: DT : 2178we352njsdfh48734 : EF and so on.

I want to find fetch the values between "DT :" and ": EF". The "2178we352njsdfh48734" will vary based on the request and the "DT :" and ": EF": will remain same for all the request.

asked 04 Jan '11, 11:33

suruthyshree's gravatar image

suruthyshree
11
accept rate: 0%

edited 04 Jan '11, 16:46

southeringtonp's gravatar image

southeringtonp ♦
4.5k1215


One Answer:

Generally, you want to either use rex or create a dedicated field extraction. For more complete information, look here.


Using rex:

In the search string, add the following to your search:

| rex field=xx "^\d+:\d+: DT : (?<txid>.*?) : EF"



For something more permanent, you can use:

transforms.conf:

[mytxid]
REGEX = "^\d+:\d+: DT : (.*?) : EF"
FORMAT = txid::$1

props.conf:

[yoursourcetype]
REPORT-txid = mytxid
link

answered 04 Jan '11, 16:46

southeringtonp's gravatar image

southeringtonp ♦
4.5k1215
accept rate: 35%

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:

×351
×68

Asked: 04 Jan '11, 11:33

Seen: 1,369 times

Last updated: 17 Mar '11, 17:22

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