Data
ID,Name,Category
1,Sofa,"Furniture,Soft furnishings,TestString"
2,Desk Chair,"Furniture,Hard furnishings,OtheString"
3,Desk Chair,"Furniture,Hard furnishings,OtheString"
# 1, Sofa, "Furniture, Soft furnishings, TestString" - is this line for test?
I tried this code:
input{
file {
path => "E:/test.csv"
start_position => "beginning"
sincedb_path => "NULL"
}
}
filter {
dissect {
mapping => {
"message" => '%{product_id}, %{name}, "%{category}, %{sub_category}, %{alt_category}"'
}
}
}
output{
elasticsearch {
hosts => "http://localhost:9200"
index => "test_products"
user => "elastic"
password => "**"
}
stdout{}
}
Then copied yours:
input{
file {
path => "E:/test.csv"
start_position => "beginning"
sincedb_path => "NULL"
}
}
filter {
dissect {
mapping => {
"message" => '%{product_id}, %{name}, "%{category}, %{sub_category}, %{alt_category}"'
# 1, Sofa, "Furniture, Soft furnishings, TestString"
}
}
}
output{
elasticsearch {
hosts => "http://localhost:9200"
index => "test_products2"
user => "elastic"
password => "*"
}
stdout{}
}
but the result is the same
"_index": "test_products",
"_id": "IcWTPYch3_",
"_score": 1,
"_source": {
"host": {
"name": "DESKTOP-5QFLCFM"
},
"message": """1,Sofa,"Furniture,Soft furnishings,TestString"
""",
"event": {
"original": """1,Sofa,"Furniture,Soft furnishings,TestString"
"""
},
"@version": "1",
"@timestamp": "2023-04-01T16:07:58.384915200Z",
"tags": [
"_dissectfailure"
],
"log": {
"file": {
"path": "C:/test.csv"
}
}
}
},
{
"_index": "test_products",
"_id": "IsWTPYcBFY9QtlnpVh3_",
"_score": 1,
"_source": {
"host": {
"name": "DESKTOP-5QFLCFM"
},
"message": """2,Desk Chair,"Furniture,Hard furnishings,OtheString"
""",
"event": {
"original": """2,Desk Chair,"Furniture,Hard furnishings,OtheString"
"""
},
"@version": "1",
"@timestamp": "2023-04-01T16:07:58.387915800Z",
"tags": [
"_dissectfailure"
],
"log": {
"file": {
"path": "C:/test.csv"
}
}
}
}
]
[/quote]
Some kind of magic, it works for you and not for me. Any idea what the reason?
the main reason is naturally me=)