Splunk Search

Propper Logging practices for list of events

sankarms
Explorer

I have a service that recommends a list of cars based on the user's input of personal information. For example, someone can send a request containing personal information and my service will respond back with a list of cars suited for their needs/personality like so:

{
    "cars": [
        {
            "type": "chevrolet equinox"
        },
        {
            "type": "ford explorer"
        },
        {
            "type": "cadillac srx"
        },
    ]
}

I want to be able to log all the cars that we send out as recommendations so I can make a bar graph that represents the number of times we've recommended all the different types of cars.

My question is, what are the best practices in this case. How can we look it so that splunk will easily be able to pick this up and generate a bar graph with?

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Making the entire event as one JSON object is a good way of letting Splunk easily understand arrays/lists, yes.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Making the entire event as one JSON object is a good way of letting Splunk easily understand arrays/lists, yes.

martin_mueller
SplunkTrust
SplunkTrust

If you're only every going to store a string per car then that would be more efficient. If for example you might one day store the model year it'd be better to split that off into an object per car with properties manufacturer, model, year, etc.

0 Karma

sankarms
Explorer

ok so would it be better to log it like this:

{
     "cars": ["chevrolet equinox","ford explorer","cadillac srx"]
 }
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...