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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...