I have a dashboard that is displaying 3 charts and a table. In the 3 charts the legend mostly consists the source path of the logs files that are being displayed in the charts. The source path is pretty long and I'd really like to just have the source path displayed as one word describing each source.
I really only want it for these charts on the dashboard and not all throughout splunk. Anyone have an idea of what the best way to do this? Do I have to put something in the actual search to tell splunk to relabel the source?
Example: /opt/log/sandstorm/home/dataserver.log.
I want it displayed in chart as just Sandstorm and not /opt/log/sandstorm/home/dataserver.log
In the search you're using to generate each graph, sometime before your stats/chart/timechart command, create a new field that holds only the last portion of the source field:
... | rex field=source "/(?<source_short>[^/]+)$"
Then split by that field instead of by source.
In the search you're using to generate each graph, sometime before your stats/chart/timechart command, create a new field that holds only the last portion of the source field:
... | rex field=source "/(?<source_short>[^/]+)$"
Then split by that field instead of by source.
This worked! sourcetype="cron_BalanceEmail" NOT host=".bmp2." earliest=-1d@d latest=-0d@d sent ([BalanceEmail] OR [null]) | rex field=_raw "\w+] ?(?
The field listed was the last portion of the log path. If the log path is /opt/log/dotinfo/eppcron/eppcron_balancememail.log, it listed as the source_short as only eppcron_balanceemail.log. I should list dotinfo.
Ok it did make a source_short field but the source listed isn't correct. I will try again
i tried renaming source_short to other things, didnt' work. I tried making the regex | rex field=source "/opt/log/(?
If i add this, the results in the table are still the same: sourcetype="cron_BalanceEmail" NOT host=".bmp2." earliest=-1d@d latest=-0d@d sent ([BalanceEmail] OR [null]) | rex field=_raw "\w+] ?(?
I didn't add that to my response because what I had didn't work. I'm still working on it.
I don't see the rex command to create a short version of the source field in there?
The location of the sourcetype for all of these logs is in the same location but each one is named differently. such as /opt/log/sandstorm/logs/sandstorm.log, /opt/log/snowstorm/logs/snowstorm.log, etc. I just want the main words like Sandstorm or Snowstorm to show up for source. I'll keep trying but any other comments are welcome!
Well I tried doing this but I haven't seen the result I need. My search I was using was: sourcetype="cron_BalanceEmail" NOT host=".bmp2." earliest=-1d@d latest=-0d@d sent ([BalanceEmail] OR [null]) | rex field=_raw "\w+] ?(?