The Emacs Problem
sites.google.com
The Emacs Problem
1–10 of 41 posts
Re: The Emacs Problem
#2Re: The Emacs Problem
#3And now anyone who can modify your log can execute arbitrary code in the reader process…
Re: The Emacs Problem
#4The way it works is that their are no mandatory newline characters in JSON. Whitespace between lexical elements is ignored, and any embedded newlines in strings can be escaped (i.e. as \n). So a log format that a few people are using today is like this:
{'kind': 'foo', 'id': 1, 'msg': 'hi'} {'kind': 'bar', 'id': 2, 'msg': 'there'}
Each log message takes up a single line in the file. You can trivially deserialize any line to a real data structure in your language of choice. You can (mostly) grep the lines, and they're human readable. I do this at work, and frequently have scripts like this:
scribereader foo | grep 'some expression' | python -c 'code here'
In this case we're storing logs in the format described above (a single JSON message per line), and scribereader is something that groks how scribe stores log files and outputs to stdout. The grep expression doesn't really understand JSON, but it catches all of the lines that I actually want to examine, and the false positive rate is very low (I feel like this is a pretty good compromise between greppability, human readability, and the ability to programatically manipulate log data.
Re: The Emacs Problem
#5One solution that Steve didn't discuss is JSON. To be fair, JSON wasn't that popular in 2005, but it's still a great solution. The way it works is that their are no mandatory newline characters in JSON. Whitespace between lexical elements is ignored, and any embedded newlines in strings can be escaped (i.e. as \n). So a log format that a few people are using today is like this: {'kind': 'foo', 'id': 1, 'msg': 'hi'} {…
Re: The Emacs Problem
#6It would be interesting to see an emacs implementation in language better suited for text manipulation like Ruby or Perl.
Re: The Emacs Problem
#7One solution that Steve didn't discuss is JSON. To be fair, JSON wasn't that popular in 2005, but it's still a great solution. The way it works is that their are no mandatory newline characters in JSON. Whitespace between lexical elements is ignored, and any embedded newlines in strings can be escaped (i.e. as \n). So a log format that a few people are using today is like this: {'kind': 'foo', 'id': 1, 'msg': 'hi'} {…
http://simonwillison.net/2008/Jun/15/steveys/
That's the problem with discussing old articles. Information gets updated
Re: The Emacs Problem
#8There is a point to be made for the idea that you are solving the wrong problem with the log parsing. On the other hand, if you are trying to interface with other developers' popular engines, you may not have a choice.
Re: The Emacs Problem
#9It would be interesting to see an emacs implementation in language better suited for text manipulation like Ruby or Perl.
Re: The Emacs Problem
#10One solution that Steve didn't discuss is JSON. To be fair, JSON wasn't that popular in 2005, but it's still a great solution. The way it works is that their are no mandatory newline characters in JSON. Whitespace between lexical elements is ignored, and any embedded newlines in strings can be escaped (i.e. as \n). So a log format that a few people are using today is like this: {'kind': 'foo', 'id': 1, 'msg': 'hi'} {…
Err, my formatting got messed up. Pretend like there's a newline between the two log entries I described.