Replace string across multiple analytics log files

Managed by | Updated .

If ever there is a need to replace a problematic string which may appear in the analytics log files which may be causing analytics to fail to load in the Administrator UI, do the following in a Linux based system.

In $SEARCH_HOME/data/<collection>/archive:

You would need to gunzip the relevant log files e.g. clicked_facet-<servername>.<date>.log.xml.gz or queries-<servername>.<date>.log.gz you require to change first.  Once that is done, do the following:

grep -l '<text to change>' *.log  | xargs sed -i 's/<text to change>/<text to be changed to>/g'

grep -l 'Printing (including the Reproduction of' *.log  | xargs sed -i 's/Printing (including the Reproduction of/Printing (including the Reproduction of Recorded Media)/g'
Was this artcle helpful?