Skip to main content
Question

What would the Source field be for a json parsed event?

  • Mar 11, 2025 3:16 AM UTC
  • 9 replies
  • 217 views

Good morning,I'm trying to remove some key/values with null values in a tcpjson event w/ the parser function. I noticed that having Source field equal to _raw doesn't access the JSON parsed log data. What would the Source field be for a json parsed event?

9 replies

  • Participating Frequently
  • Mar 11, 2025 4:20 AM UTC

I have found the following Parser() function options effective at removing keys whose values are null. You should set _raw to `JSON.stringify(_raw)` afterwards though.


  • Author
  • Employee
  • Mar 11, 2025 4:20 AM UTC

Yup, I have something similar. My problem is using a tcpjson as your source automatically parses the JSON, and it doesn't create an _raw field. So, I'm not sure how to go about accessing the keys in the event


  • Participating Frequently
  • Mar 11, 2025 4:20 AM UTC

So when your events hit the pipeline, the JSON object has already been parsed and the contents are extracted as top-level fields (including keys w/null values).


  • Author
  • Employee
  • Mar 11, 2025 4:20 AM UTC

Gotchya, is there a way to access the parsed JSON without re-writing it to _raw & back to the event?


  • Participating Frequently
  • Mar 11, 2025 4:20 AM UTC

Sorry, my comment was not meant to be a statement. It was meant to be a question.I have a TCP JSON data source on my Stream v3.5.4 instance and events come in as JSON in _raw.So, in my case the TCP JSON source is not automatically parsing the JSON.Which version of Stream are you running?


  • Author
  • Employee
  • Mar 11, 2025 4:20 AM UTC

Looks like I'm on 4.1


  • Author
  • Employee
  • Mar 11, 2025 4:20 AM UTC

and the answer to your question above is yes. There's no _raw key, everything is a top-level field


If there is a specific key you are looking at, you can use that key in parser instead of _raw. However, I assume that you are trying to apply the filter to all fields. I am not sure how to do this without a code function


  • Participating Frequently
  • Mar 11, 2025 4:20 AM UTC

Do you serialize some of the top-level fields back into _raw as a JSON object at any point in your pipeline?That would be an opportunity to filter out the keys w/null values.