16 Jan 2024 07:25 PM
Hi,
I'm working on a project where I need to parse a CSV file, but I'm not sure how to effectively read and handle each line of the text. I tried this without success :
{
"content": "Server1;Infrastructure\Server2;Infrastructure\Server3;Infrastructure",
"timestamp": "2024-01-16T18:35:32.774000000 +0000",
"log.source": "inventory"
}
Thanks for your help!
Julien
Solved! Go to Solution.
17 Jan 2024 08:13 AM
Hi!
Did you try an array?
17 Jan 2024 09:36 AM
Hello,
here is a demonstartive statement:
data record(content ="""Server1;Infrastructure\Server2;Infrastructure\Server3;Infrastructure""")
| parse content, """ARRAY{(LD:host ';' LD:mode)('\\' | EOS)}{1,}:csv_arr"""
| expand csv_arr
| fieldsFlatten csv_arr
| fields host = csv_arr.host, mode = csv_arr.mode
18 Jan 2024 10:50 AM
Hi,
Perfect! Thanks a lot 🙂