How should I handle null rows?
Here is the recommended strategy for handling nulls in your log data:
1. Identify the "Why" Before Deleting
Not all nulls are created equal. Before you remove them, look at the Message column for those rows:
- If the Message is also null: These are likely empty lines at the end of a log file. Delete them.
- If the Message has text but the Timestamp is null: This is a multi-line message (like a stack trace). Do not delete these; use the "Fill Down" method mentioned previously.
- If the Timestamp is there but the Message is null: This is rare in Spirion logs but could indicate a corrupted log entry. Investigate or Delete.
2. Use "Remove Empty" on the Raw Column
The safest way to handle completely empty rows is to filter them out at the very beginning of your Power Query steps.
- Action: Select your original "Raw Text" column (before splitting it into columns). Click the filter drop-down and uncheck (blank).
- Benefit: This removes lines that contain no data at all before you waste processing power trying to parse them.
3. Replace Nulls with "Unknown" (For Categorization)
If you have a column like Level (INF, ERR, WRN) and some rows are null, leaving them as "null" makes your Pie Charts look messy (they will show a slice labeled "null").
- Action: Right-click the Level column > Replace Values.
- Value to Find:
null(leave blank or type null depending on the view). - Replace With:
UNKNOWNorOTHER. - Benefit: This makes your visualizations much cleaner and easier for non-technical stakeholders to read.
4. The "Coalesce" Strategy (For Multiple Sources)
If you are merging logs from different agent versions, one version might have a column that the other doesn't (e.g., a newer version might include ThreadID).
- Action: Use a Custom Column with a
Coalescelogic (in M:if [ThreadID] = null then "N/A" else [ThreadID]). - Benefit: This ensures that your "Table" visual doesn't have distracting empty white space.
5. Filter Nulls from Visuals (The "Last Resort")
If you don't want to delete the data in Power Query (because you might need it later), you can hide nulls at the Report level.
- Action: Select your chart > Go to the Filters Pane > Select the field with nulls > Change "Filter Type" to Advanced Filtering > Select "is not blank".
- Benefit: The data stays in your model for troubleshooting, but your charts stay pretty.
Summary Table: Handling Nulls
Null Location | Likely Cause | Recommended Action |
|---|---|---|
Entire Row | End of file / Empty line | Remove Empty in Power Query. |
Timestamp Only | Multi-line error / Stack trace | Fill Down from the row above. |
Level/Category | Parsing failure | Replace Value with "UNKNOWN". |
Message Only | Corrupted log entry | Remove Row (it has no diagnostic value). |
Summary: Always Remove Empty rows at the start of your process to save performance. For rows where only the Timestamp is missing, use Fill Down to preserve the context of multi-line errors. For all other nulls in categorical columns, Replace them with "UNKNOWN" to keep your charts clean.