Refine your search:

Hello,

I'm trying to do an arithmetic operation between 2 values i get with a stats function. I want to divide the number of cvss by the number of hosts. Here is my serach.

sourcetype=nessus N_cvss>9 N_dnt=0 | rex "(?i)^(?:[^\t]*\t){2}(?P<host>[^\t]+)" | rex "(?i)^(?:[^\t]*\t){10}(?P<cvss>[^\t]+)" | stats dc(host) as nb_host | stats c(cvss) as nb_cvss | eval cvss_host=nb_cvss/nb_host

My values are correctly affected to fields nb_cvss and nb_host but when i use the eval function i have no result. I also tried the "eventstats" in place of "stats" but the result is the same.

How could i get the result i want ?

asked 03 Feb, 05:27

rbw78's gravatar image

rbw78
401
accept rate: 0%

edited 03 Feb, 05:31


2 Answers:

I don't really know if it affects the results, but you do not need two stats commands. Does this produce the desired result?

sourcetype=nessus N_cvss>9 N_dnt=0 | rex "(?i)^(?:[^\t]*\t){2}(?P<host>[^\t]+)" | rex "(?i)^(?:[^\t]*\t){10}(?P<cvss>[^\t]+)" | stats dc(host) as nb_host c(cvss) as nb_cvss | eval cvss_host=nb_cvss/nb_host

/k

link

answered 03 Feb, 05:34

kristian.kolb's gravatar image

kristian.kolb
3.4k210
accept rate: 30%

You resolved my issue, only one stats function is needed, thanks :)

(03 Feb, 05:38) rbw78

Well, something is wrong in my search.

I have the values nb_cvss and nb_cvss with also cvss_host in my final result. I only want cvss_host in my final result for doing a chart on the which one i can his evolution of it for each months.

So i'm trying to use timechart but it doesn't work.

sourcetype=nessus N_cvss>9 N_dnt=0 | rex "(?i)^(?:[^\t]*\t){2}(?P<host>[^\t]+)" | rex "(?i)^(?:[^\t]*\t){10}(?P<cvss>[^\t]+)" | timechart span=1m eval(c(cvss) / dc(host))

it says my eval expression must be renamed but i don't know why, it should works ...

link

answered 03 Feb, 07:53

rbw78's gravatar image

rbw78
401
accept rate: 0%

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:

×151
×133

Asked: 03 Feb, 05:27

Seen: 254 times

Last updated: 03 Feb, 07:53

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