Getting Data In

Working with CSV

reverse
Contributor

I have CSV like this-

    PPAGE_ID1   PPAGE_ID2   PPAGE_ID3   PPAGE_ID4   PPAGE_ID5   PPAGE_ID6   
1-Jan   123 123 123 123 123 123 
2-Jan   456 456 456 456 456 456 
3-Jan   789 789 789 789 789 789 
4-Jan   98  98  98  98  98  98  
5-Jan   87587   87587   87587   87587   87587   87587   

how can I take average by PPAGE_ID6 or PPAGE_ID100 ?
Please help.

Tags (2)
0 Karma
1 Solution

to4kawa
Ultra Champion
| makeresults
| eval _raw="Date,PPAGE_ID1,PPAGE_ID2,PPAGE_ID3,PPAGE_ID4,PPAGE_ID5,PPAGE_ID6
1-Jan,123,123,123,123,123,123
2-Jan,456,456,456,456,456,456
3-Jan,789,789,789,789,789,789
4-Jan,98,98,98,98,98,98
5-Jan,87587,87587,87587,87587,87587,87587"
| multikv forceheader=1
| table Date,PPAGE_ID1,PPAGE_ID2,PPAGE_ID3,PPAGE_ID4,PPAGE_ID5,PPAGE_ID6
`comment("this is your sample")`
`comment("from here, the logic")`
| table Date,PPAGE_ID1,PPAGE_ID2,PPAGE_ID3,PPAGE_ID4,PPAGE_ID5,PPAGE_ID6
| untable Date PPAGE count
| eventstats avg(count) as average by PPAGE

Hi, folks. how about this.

View solution in original post

to4kawa
Ultra Champion
| makeresults
| eval _raw="Date,PPAGE_ID1,PPAGE_ID2,PPAGE_ID3,PPAGE_ID4,PPAGE_ID5,PPAGE_ID6
1-Jan,123,123,123,123,123,123
2-Jan,456,456,456,456,456,456
3-Jan,789,789,789,789,789,789
4-Jan,98,98,98,98,98,98
5-Jan,87587,87587,87587,87587,87587,87587"
| multikv forceheader=1
| table Date,PPAGE_ID1,PPAGE_ID2,PPAGE_ID3,PPAGE_ID4,PPAGE_ID5,PPAGE_ID6
`comment("this is your sample")`
`comment("from here, the logic")`
| table Date,PPAGE_ID1,PPAGE_ID2,PPAGE_ID3,PPAGE_ID4,PPAGE_ID5,PPAGE_ID6
| untable Date PPAGE count
| eventstats avg(count) as average by PPAGE

Hi, folks. how about this.

reverse
Contributor

amazing! you are awesome!.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

That is not CSV as there are no commas. Furthermore, the number of header fields is not the same as the number of fields in each row so Splunk will not ingest it properly. Can you change how the file is created?

---
If this reply helps you, Karma would be appreciated.

reverse
Contributor

lets assume that is a proper CSV with header as page id .. 1st column as date and rows as values against that date

0 Karma

reverse
Contributor

@jnudell_2 @Vijeta please help

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...