diff -rupN bro-2.2/scripts/base/frameworks/logging/writers/ascii.bro bro-2.2--patched/scripts/base/frameworks/logging/writers/ascii.bro
--- bro-2.2/scripts/base/frameworks/logging/writers/ascii.bro	2013-11-07 10:27:11.000000000 -0800
+++ bro-2.2--patched/scripts/base/frameworks/logging/writers/ascii.bro	2013-11-19 12:52:01.000000000 -0800
@@ -27,6 +27,9 @@ export {
 	## Prefix for lines with meta information.
 	const meta_prefix = "#" &redef;
 
+	## Enable writing logs in JSON style format
+	const write_json = F &redef; 
+
 	## Separator between fields.
 	const separator = Log::separator &redef;
 
diff -rupN bro-2.2/src/logging/writers/Ascii.cc bro-2.2--patched/src/logging/writers/Ascii.cc
--- bro-2.2/src/logging/writers/Ascii.cc	2013-11-07 10:27:11.000000000 -0800
+++ bro-2.2--patched/src/logging/writers/Ascii.cc	2013-11-22 00:18:43.000000000 -0800
@@ -1,5 +1,7 @@
 // See the file "COPYING" in the main distribution directory for copyright.
 
+#include "util.h" // Needs to come first for stdint.h
+
 #include <string>
 #include <errno.h>
 #include <fcntl.h>
@@ -23,6 +25,7 @@ Ascii::Ascii(WriterFrontend* frontend) :
 
 	output_to_stdout = BifConst::LogAscii::output_to_stdout;
 	include_meta = BifConst::LogAscii::include_meta;
+	write_json = BifConst::LogAscii::write_json; 
 
 	separator.assign(
 			(const char*) BifConst::LogAscii::separator->Bytes(),
@@ -209,7 +212,18 @@ bool Ascii::DoWrite(int num_fields, cons
 
 	desc.Clear();
 
-	for ( int i = 0; i < num_fields; i++ )
+	if ( write_json ) {
+	    desc.AddRaw("{", 1);
+	    for ( int i = 0; i < num_fields; i++ )
+                {
+		    if ( i > 0 && desc.Bytes()[desc.Len()] != ',' && vals[i]->present )
+                        desc.AddRaw(",", 1);
+                    AddFieldToBuffer(&desc, vals[i], fields[i]);
+	    	}
+	    desc.AddRaw("}", 1); 
+	}
+	else {
+	    for ( int i = 0; i < num_fields; i++ )
 		{
 		if ( i > 0 )
 			desc.AddRaw(separator);
@@ -217,6 +231,7 @@ bool Ascii::DoWrite(int num_fields, cons
 		if ( ! ascii->Describe(&desc, vals[i], fields[i]->name) )
 			return false;
 		}
+	}
 
 	desc.AddRaw("\n", 1);
 
@@ -327,3 +342,135 @@ string Ascii::Timestamp(double t)
 	}
 
 
+
+bool Ascii::AddValueToBuffer(ODesc* b, Value* val)
+        {
+        switch ( val->type )
+                {
+                // ES treats 0 as false and any other value as true so bool types go here.
+                case TYPE_BOOL:
+                case TYPE_INT:
+                        b->Add(val->val.int_val);
+                        break;
+
+                case TYPE_COUNT:
+                case TYPE_COUNTER:
+                        {
+                        // ElasticSearch doesn't seem to support unsigned 64bit ints.
+                        if ( val->val.uint_val >= INT64_MAX )
+                                {
+                                Error(Fmt("count value too large: %" PRIu64, val->val.uint_val));
+                                b->AddRaw("null", 4);
+                                }
+                        else
+                                b->Add(val->val.uint_val);
+                        break;
+                        }
+
+                case TYPE_PORT:
+                        b->Add(val->val.port_val.port);
+                        break;
+
+                case TYPE_SUBNET:
+                        b->AddRaw("\"", 1);
+                        b->Add(ascii->Render(val->val.subnet_val));
+                        b->AddRaw("\"", 1);
+                        break;
+
+                case TYPE_ADDR:
+                        b->AddRaw("\"", 1);
+                        b->Add(ascii->Render(val->val.addr_val));
+                        b->AddRaw("\"", 1);
+                        break;
+
+                case TYPE_DOUBLE:
+                case TYPE_INTERVAL:
+                        b->Add(val->val.double_val);
+                        break;
+
+                case TYPE_TIME:
+                        {
+                        // ElasticSearch uses milliseconds for timestamps and json only
+                        // supports signed ints (uints can be too large).
+                        uint64_t ts = (uint64_t) (val->val.double_val * 1000);
+                        if ( ts >= INT64_MAX )
+                                {
+                                Error(Fmt("time value too large: %" PRIu64, ts));
+                                b->AddRaw("null", 4);
+                                }
+                        else
+                                b->Add(ts);
+                        break;
+                        }
+
+                case TYPE_ENUM:
+                case TYPE_STRING:
+                case TYPE_FILE:
+                case TYPE_FUNC:
+                        {
+                        b->AddRaw("\"", 1);
+                        for ( int i = 0; i < val->val.string_val.length; ++i )
+                                {
+                                char c = val->val.string_val.data[i];
+                                // 2byte Unicode escape special characters.
+                                if ( c < 32 || c > 126 || c == '\n' || c == '"' || c == '\'' || c == '\\' || c == '&' )
+                                        {
+                                        static const char hex_chars[] = "0123456789abcdef";
+                                        b->AddRaw("\\u00", 4);
+                                        b->AddRaw(&hex_chars[(c & 0xf0) >> 4], 1);
+                                        b->AddRaw(&hex_chars[c & 0x0f], 1);
+                                        }
+                                else
+                                        b->AddRaw(&c, 1);
+                                }
+                        b->AddRaw("\"", 1);
+                        break;
+                        }
+
+                case TYPE_TABLE:
+                        {
+                        b->AddRaw("[", 1);
+                        for ( int j = 0; j < val->val.set_val.size; j++ )
+                                {
+                                if ( j > 0 )
+                                        b->AddRaw(",", 1);
+                                AddValueToBuffer(b, val->val.set_val.vals[j]);
+                                }
+                        b->AddRaw("]", 1);
+                        break;
+                        }
+
+                case TYPE_VECTOR:
+                        {
+                        b->AddRaw("[", 1);
+                        for ( int j = 0; j < val->val.vector_val.size; j++ )
+                                {
+                                if ( j > 0 )
+                                        b->AddRaw(",", 1);
+                                AddValueToBuffer(b, val->val.vector_val.vals[j]);
+                                }
+                        b->AddRaw("]", 1);
+                        break;
+                        }
+
+                default:
+                        return false;
+                }
+        return true;
+        }
+
+
+bool Ascii::AddFieldToBuffer(ODesc *b, Value* val, const Field* field)
+        {
+        if ( ! val->present )
+                return false;
+
+//        b->AddRaw("\"", 1);
+        b->Add(field->name);
+	b->AddRaw(":", 1); 
+//        b->AddRaw("\":", 2);
+        AddValueToBuffer(b, val);
+        return true;
+        }
+
+
diff -rupN bro-2.2/src/logging/writers/Ascii.h bro-2.2--patched/src/logging/writers/Ascii.h
--- bro-2.2/src/logging/writers/Ascii.h	2013-11-07 10:27:11.000000000 -0800
+++ bro-2.2--patched/src/logging/writers/Ascii.h	2013-11-18 20:14:18.000000000 -0800
@@ -32,6 +32,8 @@ protected:
 	virtual bool DoHeartbeat(double network_time, double current_time);
 
 private:
+	bool AddFieldToBuffer(ODesc *b, threading::Value* val, const threading::Field* field);
+        bool AddValueToBuffer(ODesc *b, threading::Value* val);
 	bool IsSpecial(string path) 	{ return path.find("/dev/") == 0; }
 	bool WriteHeaderField(const string& key, const string& value);
 	void CloseFile(double t);
@@ -46,6 +48,7 @@ private:
 	bool output_to_stdout;
 	bool include_meta;
 	bool tsv;
+	bool write_json; 
 
 	string separator;
 	string set_separator;
diff -rupN bro-2.2/src/logging.bif bro-2.2--patched/src/logging.bif
--- bro-2.2/src/logging.bif	2013-11-07 10:27:11.000000000 -0800
+++ bro-2.2--patched/src/logging.bif	2013-11-18 20:14:58.000000000 -0800
@@ -72,6 +72,7 @@ module LogAscii;
 
 const output_to_stdout: bool;
 const include_meta: bool;
+const write_json: bool; 
 const meta_prefix: string;
 const separator: string;
 const set_separator: string;
