Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
10-16-2020
03:11 PM
- last edited on
04-21-2026
04:24 AM
by
GrazittiAPI
I have flowfile entries like the following:
{\"CommandLine\":\"/bin/sh -c ( LC_MESSAGES=C;export LC_MESSAGES;df -k | awk 'NF == 1 { printf $0; next } { print }' ) > /opt/netiq/netiq/AM/tmp/netiqKykswU\",\"ConfigBuild\":\"1007.8.0010402.9\",\"ConfigStateHash\":\"788983332\",\"Entitlements\":\"15\",\"GID\":\"0\",\"ImageFileName\":\"/usr/bin/bash\",\"MD5HashData\":\"0883bc66ffeba0e89ee0a753ddbc1950\",\"NDRoot\":\"313466589192688920\",\"ParentBaseFileName\":\"agent\",\"ParentProcessId\":\"313467877387179481\",\"ProcessEndTime\":\"1602877133.023\",\"ProcessGroupId\":\"313466594618021306\",\"ProcessStartTime\":\"1602877133.016\",\"RGID\":\"0\",\"RUID\":\"1420\",\"RawProcessId\":\"52404\",\"SHA1HashData\":\"0000000000000000000000000000000000000000\",\"SHA256HashData\":\"c1c73170d33c0319a795bb05b1dbe7884b7582ec9f696d8a795e0ce692cb714e\",\"SVGID\":\"0\",\"SVUID\":\"1420\",\"SessionProcessId\":\"313467877387179481\",\"SourceProcessId\":\"313467877387179481\",\"SourceThreadId\":\"0\",\"TargetProcessId\":\"317237720018782501\",\"UID\":\"1420\",\"aid\":\"5b13c4513710431846be50a7840630aa\",\"aip\":\"164.95.95.156\",\"cid\":\"dbd8aea753b140cfa86a0e4d85d2dbb0\",\"event_platform\":\"Lin\",\"event_simpleName\":\"ProcessRollup2\",\"id\":\"39244150-0fe7-11eb-ba54-0a51f8dd8adc\",\"name\":\"ProcessRollup2LinV6\",\"timestamp\":\"1602877133547\",\"ComputerName\":\"testdata\"}"}
The highlighted section demonstrates a portion that has special characters that are not escaped. This is causing problems downstream. How do I escape those characters without double escaping others that are OR escaping the FIRST { or the LAST }
Thanks in advance
Created 10-17-2020 08:11 AM
In this case the problem isn't escaping the special characters in the middle of the flowfile, instead an efficient use of the ReplaceText processor was needed. As it turns out the only real need was to add a comma after the last '}' of every line except the last. ReplaceText handles this nicely and gives me the opportunity to inspect the objects line-by-line instead of the entire text. This is accomplished with setting the Search Value: }$ (this means find a } but only if it's at the end of the line) and then setting the Replacement Value: }, replacing the } character with another but appending a comma to the end.
By inspecting line by line it also reduces resources required.
Created 10-17-2020 08:11 AM
In this case the problem isn't escaping the special characters in the middle of the flowfile, instead an efficient use of the ReplaceText processor was needed. As it turns out the only real need was to add a comma after the last '}' of every line except the last. ReplaceText handles this nicely and gives me the opportunity to inspect the objects line-by-line instead of the entire text. This is accomplished with setting the Search Value: }$ (this means find a } but only if it's at the end of the line) and then setting the Replacement Value: }, replacing the } character with another but appending a comma to the end.
By inspecting line by line it also reduces resources required.