jmkim
November 30, 2018, 1:44am
1
Hello everyone!
Here is the code:
m_mkt="CUK45:cuk45_moonv2_ab4533fd85f7d55ce6a1a695fdfb9300;"
result:
CUK45=cuk45_moonv2_ab4533fd85f7d55ce6a1a695fdfb9300
However, the result is this.
CUK45 = CUK45:cuk45_moonv2_ab4533fd85f7d55ce6a1a695fdfb9300;
kv {
source => "url_params"
field_split => "&"
value_split => "="
allow_duplicate_values => false
target => "url_params_hash"
}
if [url_params_hash][m_mkt] !~ /^http/ {
mutate {
gsub => [ "[url_params_hash][m_mkt]", "CUK45:", "" ]
gsub => [ "[url_params_hash][m_mkt]", ";", ""]
rename => { "[url_params_hash][m_mkt]" => "[url_params_hash][CUK45]" }
}
}
I would like to receive your help.
Thank you!
Eniqmatic
(Lewis Barclay)
November 30, 2018, 8:23am
2
Can you add a tag in the mutate field to see if your conditional statement is working?
jmkim
November 30, 2018, 8:38am
3
I can.
rename => { "[url_params_hash][m_mkt]" => "[url_params_hash][CUK45]"
[url_params_hash][m_mkt] = "CUK45:cuk45_moonv2_ab4533fd85f7d55ce6a1a695fdfb9300;"
[url_params_hash] [CUK45] = "CUK45:cuk45_moonv2_ab4533fd85f7d55ce6a1a695fdfb9300;"
The data of the rename's [url_params_hash] [CUK45] is "CUK45 = CUK45: cuk45_moonv2_ab4533fd85f7d55ce6a1a695fdfb9300; "
Eniqmatic
(Lewis Barclay)
November 30, 2018, 8:39am
4
So you added a tag to the conditional statement and it works OK? Have you tried escaping the colon in the gsub statement?
jmkim
November 30, 2018, 8:47am
5
I did.
if [url_params_hash][m_mkt] !~ /^http/ {
mutate {
add_field => { "test" => "mutate" }
gsub => [ "[url_params_hash][m_mkt]", "CUK45:", "" ]
gsub => [ "[url_params_hash][m_mkt]", "/;", ""]
rename => { "[url_params_hash][m_mkt]" => "[url_params_hash][CUK45]" }
}
}
{
"_index": "order_20181130",
"test": "mutate",
"CUK45": "CUK45:cuk45_inblacks_46c3976034f67a76925f4dc729674b28;",
},
}
Eniqmatic
(Lewis Barclay)
November 30, 2018, 8:53am
6
Can you try:
gsub => [ "[url_params_hash][m_mkt]", "CUK45\:", "" ]
jmkim
November 30, 2018, 8:57am
7
Thank you!
The issue has been resolved.
I try:
gsub => [ "[url_params_hash][m_mkt]", "CUK45\:", "" ]
gsub => [ "[url_params_hash][m_mkt]", "\;", "" ]
Eniqmatic
(Lewis Barclay)
November 30, 2018, 8:59am
8
What changed from the first one??
jmkim
November 30, 2018, 9:03am
9
I changed rename to add_field and tried escaping
jmkim:
gsub => [ "[url_params_hash][m_mkt]", "CUK45\:", "" ]
gsub => [ "[url_params_hash][m_mkt]", "\;", "" ]
add_field => { "CUK45" => "%{[url_params_hash][m_mkt]}" }
Eniqmatic
(Lewis Barclay)
November 30, 2018, 9:06am
10
Excellent, so the escape worked! Glad you got it sorted Please mark as solution if completed!
system
(system)
Closed
December 28, 2018, 9:23am
12
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.