Dashboards & Visualizations

How to extract fields with same name for visualization?

cpramuk
Explorer

I'm trying to extract and dashboard the latest number in my logs for each "7d" stat.

Some sample logs:

[db]: 00:05:01.000: 3ddesigns:total 173304125

[db]: 00:05:01.000: 3ddesigns:1d 253113

[db]: 00:05:01.000: 3ddesigns:7d 1435675

[db]: 00:05:01.000: 3ddesigns:30d 5863610

[db]: 00:05:01.000: 3dlessons:total 92148058

[db]: 00:05:01.000: 3dlessons:1d 103077

[db]: 00:05:01.000: 3dlessons:7d 539695

[db]: 00:05:01.000: 3dlessons:30d 2216809

[db]: 00:05:01.000: circuitsdesigns:total 62150103

[db]: 00:05:01.000: circuitsdesigns:1d 125770

[db]: 00:05:01.000: circuitsdesigns:7d 724227

[db]: 00:05:01.000: circuitsdesigns:30d 2936667

I have a search query but it gives me a Null field...is there a way to rename the fields?:

obs_mnkr="tnkrcad-p-ue1" source="/disk/logtxt/stats.log" 
| multikv noheader=t
| fields _raw
| rex "3ddesigns:(?<designs>\w+)\s+(?<num>\d+)"
| regex designs!="1d"
| regex designs!="30d"
| regex designs!="total"
| rex "circuitsdesigns:(?<circuits>\w+)\s+(?<num>\d+)"
| regex circuits!="1d"
| regex circuits!="30d"
| regex circuits!="total"
| timechart span=1w last(num) by designs

 

Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Not clear what your expected output is, but is this what you are looking for

obs_mnkr="tnkrcad-p-ue1" source="/disk/logtxt/stats.log" 
| multikv noheader=t 
| fields _raw 
| search 7d
| rex "(?<designs>\w+):(?<span>\w+)\s+(?<num>\d+)"
| timechart span=1w last(num) by designs

View solution in original post

cpramuk
Explorer

Thank you!!...I was missing the "search 7d" in all of my trials....

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Not clear what your expected output is, but is this what you are looking for

obs_mnkr="tnkrcad-p-ue1" source="/disk/logtxt/stats.log" 
| multikv noheader=t 
| fields _raw 
| search 7d
| rex "(?<designs>\w+):(?<span>\w+)\s+(?<num>\d+)"
| timechart span=1w last(num) by designs
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...