Apache: escaping control characters in logs

Apache: escaping control characters in logs

Post by Phil Howa » Mon, 10 May 1999 04:00:00

Before I spend the time to do this critical hack in 1.3.6, I'd like to
first check and see if anyone else has done this already.  The issue
is formatting a log file (probably a custom format) where no request
can possibly inject anything into the log that would fool any parsing.
For example, injecting quotes and newline characters can easily make
up false log entries.

Yes, I read the documentation where the writer referred to some log ago
statement about being concerned about escape characters.  However, my
concerns are entirely on security.

Phil Howard           KA9WGN


1. add control characters using sed with escape sequences?

Ok, I've managed to pull out most of the hair on my head over this

I want to do the opposite to what most people seem to be asking.  I
have an ascii text file on my unix server and I wish to add Ctrl-M
(^M) characters to the end of each line in the file.  There are no ^M
characters in the file presently.

I can do this rather easily using the following sed command,

  sed -e 's/$/^M/' infile > outfile

where ^M is entered as a control character using Ctrl-V + Ctrl-M.

However, what I need to do is create a script that does not contain
the control character ^M in the sed command.  I would like to use an
escape sequence for the ^M character so that my script does not
contain any control characters.

Is that possible using sed?  I have seen many posts that mention it is
hard to use escape sequences in sed.

An option might be to use the translate command "tr" however I have
had no luck using this command.



2. Scripting Question

3. Using sed with control/escape characters


5. Questions regarding recognizing control/escape characters.

6. Establishing a socket between a perl client a c server

7. mapping escape sequences to control characters in KSH

8. Madge Blue+ Errors

9. ZMODEM version differences; Escape Control Characters

10. Escape character control

11. looking for an escape function (ansi c) to escape characters for usage in an URL

12. Apache redirect is escaping the ? character

13. Need HELP to Log User Log-ins form the internet