Refine your search:

I have the following search string:

index=other_gomez sourcetype=other_gomez_avail http://myreports.yellowpages.ca/ earliest=-2w-2d latest=-2d | eval Date=if(_time>relative_time(now(),"-1w-2d"),"this_week","last_week") | chart count over pagestatus by Date  | table pagestatus last_week this_week | addcoltotals | eval pagestatus=if(isnull(pagestatus),"TOTAL",pagestatus) | fields pagestatus,last_week,this_week | rename pagestatus as "Page Status" last_week as "Last week" this_week as "This week"

I'm trying to calculate the percentage failed for this week and last week (FAIL/TOTAL). How can I divide values in the same field?

asked 30 Mar '12, 10:16

acabrera1's gravatar image

acabrera1
212
accept rate: 0%

edited 30 Mar '12, 10:17

ziegfried's gravatar image

ziegfried ♦
10.1k1618


One Answer:

You can use appendpipe to calculate the fraction of "FAIL" over "TOTAL" per week from the table and append a new row:

| appendpipe [chart eval(100*sum(eval(if(pagestatus=="FAIL", "Last week", 0)))/sum(eval(if(pagestatus=="TOTAL", "Last week", 0)))) as "Last week" eval(100*sum(eval(if(pagestatus=="FAIL", "This week", 0)))/sum(eval(if(pagestatus=="TOTAL", "This week", 0)))) as "This week" | eval "Page Status" = "Failure percent"]
link

answered 30 Mar '12, 11:30

Stephen%20Sorkin's gravatar image

Stephen Sorkin ♦
8.9k510
accept rate: 52%

appendpipe! I never knew there was such a command and it worked! Thanks so much for your help!!

(02 Apr '12, 08:27) acabrera1
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:

×181
×4

Asked: 30 Mar '12, 10:16

Seen: 831 times

Last updated: 02 Apr '12, 08:27

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