Splunk Search

How do I combine my two searches to graph two different fields in one graph?

Spiere
Path Finder

Hey guys,

I'm trying to create a graph which calculates the number of logs that fit the text critieria I am searching for. I want to have two different fields mapped on the same graph. I can map them separately correctly, but I would like to have them both on the same graph. These are the two searches I am running to create them on two separate graphs.

sourcetype=testing DrupalPHPFatal="Error: PHP FATAL Error"  | top limit=5 DrupalFatal
sourcetype=testing PhpFatal="Fatal error"="PHP Fatal Error"  | top limit=5 PhpFatal

I have tried putting then together with a command like:

sourcetype=testing PhpFatal="PHP Fatal error" OR DrupalPHPFatal="Error: PHP FATAL Error"  | top limit=5 PhpFatal, DrupalPHPFatal

but it doesnt not return any results. How can I accomplish this task by having both of these graphs combined?

Thanks.

0 Karma
1 Solution

somesoni2
Revered Legend

Depends upon what type of graph you want to use, you can combine both resultset using append or appendcol etc.

sourcetype=testing DrupalPHPFatal="Error: PHP FATAL Error" | top limit=5 DrupalFatal | append [
sourcetype=testing PhpFatal="Fatal error"="PHP Fatal Error" | top limit=5 PhpFatal]

View solution in original post

somesoni2
Revered Legend

Depends upon what type of graph you want to use, you can combine both resultset using append or appendcol etc.

sourcetype=testing DrupalPHPFatal="Error: PHP FATAL Error" | top limit=5 DrupalFatal | append [
sourcetype=testing PhpFatal="Fatal error"="PHP Fatal Error" | top limit=5 PhpFatal]

Spiere
Path Finder

The graph I am using is a bar graph. Also, trying that command, it tells me that "unknown search command "sourcetype"

0 Karma

somesoni2
Revered Legend

Do you want to plot both DrupalFatal and PhpFatal in same x-axis? I believe yes, they use this

 sourcetype=testing DrupalPHPFatal="Error: PHP FATAL Error" | top limit=5 DrupalFatal | rename DrupalFatal as Fatal | append [
 sourcetype=testing PhpFatal="Fatal error"="PHP Fatal Error" | top limit=5 PhpFatal | rename PhpFatal as Fatal]
0 Karma

Spiere
Path Finder

The count is on the xaxis since its a sideways graph, but I just want a count of the number of matches in both of those types. Also, that command gives me the same error as above when typed in - "unknown search command "sourcetype"

0 Karma

somesoni2
Revered Legend

Sorry about the error, missed one keyword.

 sourcetype=testing DrupalPHPFatal="Error: PHP FATAL Error" | top limit=5 DrupalFatal | rename DrupalFatal as Fatal | append [search 
  sourcetype=testing PhpFatal="Fatal error"="PHP Fatal Error" | top limit=5 PhpFatal | rename PhpFatal as Fatal]
0 Karma
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 ...