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
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...