コード例 #1
0
        public static void WriteBulkEntry(ElbLogEntry entry, TextWriter writer)
        {
            // todo - use time based index
            var header = new { index = new { _index = "elb-logs", _type = "elb-log-entry", _id = entry.id } };

            _serializer.Serialize(writer, header);
            writer.WriteLine();
            _serializer.Serialize(writer, entry);
            writer.WriteLine();
        }
コード例 #2
0
 private async Task PostEntriesAsync(TempFile file, ITargetBlock <ElbLogEntry> target)
 {
     using (file)
         using (var fs = file.OpenRead())
             using (var reader = new StreamReader(fs, Encoding.UTF8, true, 128 << 10))
             {
                 for (var line = reader.ReadLine(); line != null; line = reader.ReadLine())
                 {
                     var result = ElbLogEntry.TryParse(line);
                     if (result.WasSuccessful)
                     {
                         await target.SendAsync(result.Value);
                     }
                 }
             }
 }