Refine your search:

Consider log entries such as the following:

20110605.132223 CONNECT misc.data 10.10.10.2 ID=12345
20110605.132298 ADD misc.data ID=12345
20110605.132298 MOD misc.data ID=12345
20110605.132298 DISCONNECT misc.data ID=12345

So, this is a transaction, but notice that only the CONNECT event has the IP. I can't group on the ID value as it is not unique across log files. So I am using transaction to group the record based on a time range AND the ID.

Now, there may be matches that include other IP addresses. This is because a transaction might be between 2 or more servers. So, post transaction, the resulting record from the search may have other IP's in it.

Ultimately, the purpose of the report is to count the various transaction types (CONNECT, ADD, ETC) by IP, but I only want to include 4 specific IP's in the results. So, my chart will ultimately have only 4 IP's on it.

How can I tell chart to only include the ip addresses that I specify using OR.

asked 06 Jun '11, 12:03

timmy13's gravatar image

timmy13
36124
accept rate: 0%

Are you saying that you could have a line in the middle of those 4 that says "... CONNECT misc.data 10.10.10.50 ID=12345"?

(06 Jun '11, 17:41) mw

Yes Precisely. Because 10.10.10.2 might be connecting to 10.10.10.50. I only care about 10.10.10.2 thought so I want to chart on it alone and not records for .50.

(07 Jun '11, 06:03) timmy13

One Answer:

Is the ID unique within a log file? If so, the following should work...
Assume that the ip address is extracted into a field named IP and that the transaction type is extracted as a field named transtype.

I'd break this into 2 steps: First, associate an IP address with a source + ID combination

sourcetype=yoursourcetype | transaction source, ID mvlist=true | eval reportIP = mvindex(IP,1) | table source, ID, reportIP, transtype

This will give you a table output; notice that transtype will be a list of the various transaction types that appear in the transaction. Also note that we pick up only the first IP address that appears in the transaction. Our next task is to break this back into separate events, so we can count them...

Count the number of each transaction types by IP - add this to the end of the previous search

| mvexpand transtype | stats count by reportIP, transtype

The full picture

sourcetype=yoursourcetype | transaction source, ID mvlist=true | eval reportIP = mvindex(IP,1) | table source, ID, reportIP, transtype | mvexpand transtype | stats count by reportIP, transtype

I hope this is what you wanted! Let me know if it doesn't work for you.

link

answered 07 Jun '11, 15:26

lguinn's gravatar image

lguinn ♦
3.1k216
accept rate: 24%

edited 07 Jun '11, 15:27

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:

×134
×47

Asked: 06 Jun '11, 12:03

Seen: 5,879 times

Last updated: 07 Jun '11, 15:27

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