Splunk Search

Can I display the variable concatenated in a table?

cgaete
Explorer

Hi, everyone

When I create a field concatenated with eval, example: |eval date = day. "/" .month." /". year. |
Can I display the variable date in a table?.

Note: I use Splunk 6.1.

Thanks

0 Karma
1 Solution

horsefez
Motivator

Hi cgaete,

if the fields
- day
- month
- year
are valid fields in your data you can do something like this.

| eval date = day + "/" + month + "/" + year | table date

View solution in original post

woodcock
Esteemed Legend

I don't understand; your question is so elemental that it should have taken you 10 times longer to post this question than it could have taken you to actually try it and see that it works. If you really do have a problem, then post samples events and your search.

0 Karma

horsefez
Motivator

Hi cgaete,

if the fields
- day
- month
- year
are valid fields in your data you can do something like this.

| eval date = day + "/" + month + "/" + year | table date

woodcock
Esteemed Legend

I would never use + for concatenation operator because it also the addition operator and the latter has higher precedence making an invisible land mine for somebody (maybe even yourself) later on. I think that the original problem was a lack of spaces around each . operator.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...