Dashboards & Visualizations

How to make Splunk Dashboard Studio table column align to the left?

DPOIRE
Path Finder

Hi,

I created a table using Splunk Dashboard Studio (Absolute).  However a column contains results like A, B, C, 0, 1.
A, B and C display align left and 0 and 1 displays aligned right.
I want all to be align left.

When selecting code option to add align command, I keep getting error and it does not align left.
How should I code this:

"options": {
"columnFormat": {"align": "left"}
}

Labels (1)
0 Karma

vinod743374
Communicator
Here I am Pasted the Entire Table Code, You can find the align : center in that, you can implement the same in your table Code.

you can use left , Right, Center



{
    "type": "splunk.table",
    "dataSources": {
        "primary": "ds_nbdmjwIg"
    },
    "options": {
        "backgroundColor": "transparent",
        "tableFormat": {
            "rowBackgroundColors": "> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)",
            "rowColors": "> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)",
            "headerBackgroundColor": "> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
            "headerColor": "> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)"
        },
        "headerVisibility": "none",
        "columnFormat": {
            "Parameter": {
                "data": "> table | seriesByName(\"Parameter\") | formatByType(ParameterColumnFormatEditorConfig)"
            }
        },
        "showRowNumbers": true,
        "align":"center"
    },
    "context": {
        "ParameterColumnFormatEditorConfig": {
            "string": {
                "unitPosition": "after"
            }
        }
    },
    "showProgressBar": false,
    "showLastUpdated": false
}


Thankyou.

DPOIRE
Path Finder

Unfortunately, it makes no difference.
0 and 3 still aligned right instead of left ( R, S b ).

See attached

DPOIRE_0-1652722486313.png

 

0 Karma

vinod743374
Communicator

Can you Please try this Code once,

{
    "type": "splunk.table",
    "options": {
        "count": 100,
        "dataOverlayMode": "none",
        "drilldown": "none",
        "percentagesRow": false,
        "rowNumbers": false,
        "totalsRow": false,
        "wrap": false,
        "tableFormat":{
            "align":"> table |pick(alignment)"
        },
        "columnFormat": {
            "messegetype": {
                "data": "> table | seriesByName(\"messegetype\") | formatByType(messegetypeColumnFormatEditorConfig)"
            }
        },
        "showRowNumbers": false
    },
    "dataSources": {
        "primary": "ds_search_1"
    },
    "title": "Right Alignment",
    "context": {
        "messegetypeColumnFormatEditorConfig": {
            "string": {
                "unitPosition": "after"
                
            }
        },
        "alignment": [
            "left"
        ]
    },
    "showProgressBar": false,
    "showLastUpdated": false
}

Let me know is this works.
Tags (1)

visvar90
Engager

I have tried to center align the table using the method below. But the table always align the data to the left irrespective of center or right

0 Karma

vinod743374
Communicator

Try this Sample Dashboard Code and understand the code and then apply to u r scenario, it should work.

{
    "visualizations": {
        "viz_RVm8V48A": {
            "type": "splunk.table",
            "options": {
                "columnFormat": {
                    "sum(bytes_in)": {
                        "data": "> table | seriesByName(\"sum(bytes_in)\") | formatByType(sum_bytes_in_ColumnFormatEditorConfig)"
                    }
                },
                "tableFormat": {
                    "align": "> table |pick(alignment)"
                }
            },
            "dataSources": {
                "primary": "ds_egVRJIic"
            },
            "context": {
                "sum_bytes_in_ColumnFormatEditorConfig": {
                    "number": {
                        "thousandSeparated": false,
                        "unitPosition": "after"
                    }
                },
                "alignment": [
                    "center"
                ]
            }
        }
    },
    "dataSources": {
        "ds_egVRJIic": {
            "type": "ds.search",
            "options": {
                "query": "| inputlookup firewall_example.csv\r\n| stats sum(bytes_in) sum(bytes_out) count by host",
                "queryParameters": {
                    "earliest": "-24h@h",
                    "latest": "now"
                }
            },
            "name": "Search_1"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "latest": "$global_time.latest$",
                        "earliest": "$global_time.earliest$"
                    }
                }
            }
        }
    },
    "inputs": {},
    "layout": {
        "type": "absolute",
        "options": {
            "width": 1440,
            "height": 960,
            "display": "auto"
        },
        "structure": [
            {
                "item": "viz_RVm8V48A",
                "type": "block",
                "position": {
                    "x": 130,
                    "y": 80,
                    "w": 1240,
                    "h": 260
                }
            }
        ],
        "globalInputs": []
    },
    "description": "",
    "title": "Test"
}
 
 
If isn't work for u, can share u r sample data will help u accordingly.
 
Thankyou!

visvar90
Engager

It worked for me. Thanks for the help. Really appreciate it.

Tags (4)
0 Karma

surens
Explorer

It's working 

Thanks,

0 Karma

JHannan
Explorer

Your solution works, though I was being tripped up by two separate "option" clauses.  I had drill downs enabled on my table, but left the other options default.  This left the base "options" clause out, but a second "options" clause was nested on the eventHandlers clause.  I had to change something to fix this.  In my case, I turned on Column Formatting for two of the fields in the table.  

This is my table with your alignment option added.  Thanks!

 

		"viz_tbl_cnt_by_user": {
			"type": "splunk.table",
			"dataSources": {
				"primary": "ds_qWJPJZ6C"
			},
			"eventHandlers": [
				{
					"type": "drilldown.setToken",
					"options": {
						"tokens": [
							{
								"token": "tkn_user",
								"key": "row.identity.value"
							}
						]
					}
				}
			],
			"options": {
				"tableFormat": {
					"align": "> table |pick(alignment)"
				},
				"columnFormat": {
					"identity": {
						"data": "> table | seriesByName(\"identity\") | formatByType(identityColumnFormatEditorConfig)"
					},
					"usernames": {
						"data": "> table | seriesByName(\"usernames\") | formatByType(usernamesColumnFormatEditorConfig)"
					}
				}
			},
			"context": {
				"identityColumnFormatEditorConfig": {
					"string": {
						"unitPosition": "after"
					}
				},
				"usernamesColumnFormatEditorConfig": {
					"string": {
						"unitPosition": "after"
					}
				},
				"alignment": [
					"left"
				]
			}
		}
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...