Edit in JSFiddle

var MASTER = "master", SLAVES = "slaves";
var LABELS = {
    IN: "»",
    OUT: "«",
    WORKING: "...",
    ERROR: "!",
};
var TEXT_TO_EMOJI = {
    "pomme": "data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTguMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDU2LjY3MyA1Ni42NzMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDU2LjY3MyA1Ni42NzM7IiB4bWw6c3BhY2U9InByZXNlcnZlIiB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4Ij4KPGc+Cgk8cGF0aCBzdHlsZT0iZmlsbDojRDEzODM0OyIgZD0iTTMxLjQ4MywxNi4yMTNjLTIuMDY1LDAuNTExLTQuMjI3LDAuNTExLTYuMjkyLDBjLTEwLjc1Ni0yLjY2LTE5Ljc2Mi0xLjY0LTE5LjY1OCwxOC42NDMgICBjMC4wNTMsMTAuMzksOS43ODMsMjMuODYyLDIwLjAwOSwyMS41NTdjMS44MzQtMC40MTMsMy43NTUtMC40MTMsNS41ODksMGMxMC4yMjYsMi4zMDUsMTkuOTU2LTEx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join(z) + n;
}

function getEmojiImg(name) {
    return '<img src="' + TEXT_TO_EMOJI[name] + '" alt="' + name + '" class="emoji" />';
}

function replaceByEmoji(text) {
    for (var name in TEXT_TO_EMOJI) {
        text = text.replace(new RegExp(name, "g"), getEmojiImg(name));
    }
    return text;
}

function addMessage(msg, container) {
    var date = new Date(msg.timestamp);
    var html = "" + pad(date.getMinutes(), 2) + ":" + pad(date.getSeconds(), 2) + " - ";
    if (msg.type == SLAVES) {
        html += "(" + msg.agent + ") - ";
    }
    html += "(" + msg.task + ") : " + replaceByEmoji(msg.text);

    var wrapper = document.createElement("div");
    wrapper.dataset.task = msg.task;
    wrapper.className = "message " + msg.type;

    var text = document.createElement("div");
    text.innerHTML = html;
    text.className = "text";

    var label = document.createElement("div");
    label.className = "label";
    label.innerHTML = msg.label;

    wrapper.appendChild(label);
    wrapper.appendChild(text);
    container.appendChild(wrapper);

    wrapper.addEventListener("mouseover", function() {
        for (var wrapper of document.querySelectorAll(".message[data-task='" + msg.task + "']")) {
            wrapper.className = wrapper.className + " active";
        }
    });

    wrapper.addEventListener("mouseout", function() {
        var classes, index;
        for (var wrapper of document.querySelectorAll(".message.active")) {
            classes = wrapper.className.split(" ");
            index = classes.indexOf("active");
            if (index != -1) {
                classes.splice(index, 1);
            }
            wrapper.className = classes.join(" ");
        }
    });
}

function parseMsg(text, type) {
    // [timestamp][agent][task][label]text
    var rgTimestamp = "\\[([0-9\\.]+)\\]",
        rgAgent = "\\[([\\w-]+)\\]",
        rgTask = "\\[([\\w-]+)\\]",
        rgDirection = "\\[(\\w*)\\]",
        rgText = "(.+)";
    var msgRegexp = new RegExp("^" + rgTimestamp + rgAgent + rgTask + rgDirection + rgText);
    var parts = text.match(msgRegexp);
    var label = parts[4];

    return {
        type,
        timestamp: parseFloat(parts[1]) * 1000,
        agent: parts[2],
        task: parts[3],
        label: label ? LABELS[label] : LABELS.NO,
        text: parts[5].trim(),
    };
}

function listMessages(container, type) {
    var lines = container.innerHTML.split("\n");
    var messages = [],
        msg;
    for (var line of lines) {
        line = line.trim();
        if (line) {
            messages.push(parseMsg(line, type));
        }
    }
    return messages;
}

function editFooter(footer) {
    if (!footer.innerHTML.trim()) {
        footer.innerHTML = "Snif, la salade de fruits n'a pas pu être terminée...";
        return;
    }

    var emojis = [];
    for (var name in TEXT_TO_EMOJI) {
        emojis.push(getEmojiImg(name));
    } 

    var div = document.createElement("div");
    div.innerHTML = emojis.join(" ");
    div.style.marginBottom = "5px";
    div.style.fontSize = "18px";
    footer.insertBefore(div, footer.firstChild);
}


var containers = {};
containers[MASTER] = document.getElementById(MASTER + "-messages");
containers[SLAVES] = document.getElementById(SLAVES + "-messages");

var messages = [];
for (var type in containers) {
    messages = messages.concat(listMessages(containers[type], type));
}

messages.sort(function(a, b) {
    var delta = a.timestamp - b.timestamp;
    if (!delta) {
        return (a.type < b.type) ? -1 : 1; 
    }
    return delta;
});

var messagesContainer = document.getElementById("messages");
for(var msg of messages) {
    addMessage(msg, messagesContainer);
}

editFooter(document.getElementById("footer"));
<div id="master-messages">
  [1542564498.521064][MAITRE][T-10][OUT] 1 cerise envoyée à la préparation
[1542564498.535781][MAITRE][T-09][OUT] 1 pomme envoyée à la préparation
[1542564498.544484][MAITRE][T-08][OUT] 1 pomme envoyée à la préparation
[1542564499.523545][MAITRE][T-10][IN] 1 cerise préparée reçue. En cours : pomme (T-9), pomme (T-8)
[1542564499.525506][MAITRE][T-07][OUT] 1 pêche envoyée à la préparation
[1542564501.549915][MAITRE][T-08][IN] 1 pomme préparée reçue. En cours : pomme (T-9), pêche (T-7)
[1542564501.551296][MAITRE][T-06][OUT] 1 banane envoyée à la préparation
[1542564502.529351][MAITRE][T-07][IN] 1 pêche préparée reçue. En cours : pomme (T-9), banane (T-6)
[1542564502.53073][MAITRE][T-05][OUT] 1 banane envoyée à la préparation
[1542564503.555749][MAITRE][T-06][IN] 1 banane préparée reçue. En cours : pomme (T-9), banane (T-5)
[1542564503.55739][MAITRE][T-04][OUT] 1 pastèque envoyée à la préparation
[1542564504.535395][MAITRE][T-05][IN] 1 banane préparée reçue. En cours : pomme (T-9), pastèque (T-4)
[1542564504.536169][MAITRE][T-09][WORKING] remet la pomme dans le panier à préparer
[1542564504.537421][MAITRE][T-09][OUT] 1 pomme envoyée à la préparation
[1542564507.542727][MAITRE][T-09][IN] 1 pomme préparée reçue. En cours : pastèque (T-4)
[1542564507.544653][MAITRE][T-03][OUT] 1 poire envoyée à la préparation
[1542564509.549536][MAITRE][T-03][IN] 1 poire préparée reçue. En cours : pastèque (T-4)
[1542564509.551487][MAITRE][T-02][OUT] 1 poire envoyée à la préparation
[1542564509.55801][MAITRE][T-04][WORKING] remet la pastèque dans le panier à préparer
[1542564511.556221][MAITRE][T-02][IN] 1 poire préparée reçue. En cours : rien
[1542564511.557807][MAITRE][T-04][OUT] 1 pastèque envoyée à la préparation
[1542564515.563644][MAITRE][T-04][IN] 1 pastèque préparée reçue. En cours : rien
[1542564515.565104][MAITRE][T-01][OUT] 1 pêche envoyée à la préparation
[1542564518.569116][MAITRE][T-01][IN] 1 pêche préparée reçue. En cours : rien
[1542564518.570476][MAITRE][T-00][OUT] 1 cerise envoyée à la préparation
[1542564519.57298][MAITRE][T-00][IN] 1 cerise préparée reçue. En cours : rien
  </div>

  <div id="slaves-messages">
  [1542564498.521448][E-21530][T-10][IN] 1 cerise à préparer reçue
[1542564498.521557][E-21530][T-10][WORKING] 1 cerise en préparation (1s)
[1542564498.536171][E-21529][T-09][IN] 1 pomme à préparer reçue
[1542564498.536215][E-21529][T-09][WORKING] 1 pomme en préparation (3s)
[1542564498.544855][E-21528][T-08][IN] 1 pomme à préparer reçue
[1542564498.544891][E-21528][T-08][WORKING] 1 pomme en préparation (3s)
[1542564499.521798][E-21530][T-10][OUT] 1 cerise prête envoyée
[1542564499.526724][E-21530][T-07][IN] 1 pêche à préparer reçue
[1542564499.526807][E-21530][T-07][WORKING] 1 pêche en préparation (3s)
[1542564501.537771][E-21529][T-09][ERROR] alerte, une panne ! 1 pomme en préparation
[1542564501.547703][E-21528][T-08][OUT] 1 pomme prête envoyée
[1542564501.551681][E-21528][T-06][IN] 1 banane à préparer reçue
[1542564501.551719][E-21528][T-06][WORKING] 1 banane en préparation (2s)
[1542564502.527691][E-21530][T-07][OUT] 1 pêche prête envoyée
[1542564502.531736][E-21530][T-05][IN] 1 banane à préparer reçue
[1542564502.531808][E-21530][T-05][WORKING] 1 banane en préparation (2s)
[1542564503.553891][E-21528][T-06][OUT] 1 banane prête envoyée
[1542564503.558441][E-21528][T-04][IN] 1 pastèque à préparer reçue
[1542564503.558528][E-21528][T-04][WORKING] 1 pastèque en préparation (4s)
[1542564504.533932][E-21530][T-05][OUT] 1 banane prête envoyée
[1542564504.538475][E-21530][T-09][IN] 1 pomme à préparer reçue
[1542564504.53856][E-21530][T-09][WORKING] 1 pomme en préparation (3s)
[1542564507.541047][E-21530][T-09][OUT] 1 pomme prête envoyée
[1542564507.54563][E-21530][T-03][IN] 1 poire à préparer reçue
[1542564507.545708][E-21530][T-03][WORKING] 1 poire en préparation (2s)
[1542564507.560985][E-21528][T-04][ERROR] alerte, une panne ! 1 pastèque en préparation
[1542564509.547883][E-21530][T-03][OUT] 1 poire prête envoyée
[1542564509.552627][E-21530][T-02][IN] 1 poire à préparer reçue
[1542564509.552739][E-21530][T-02][WORKING] 1 poire en préparation (2s)
[1542564511.554429][E-21530][T-02][OUT] 1 poire prête envoyée
[1542564511.55861][E-21530][T-04][IN] 1 pastèque à préparer reçue
[1542564511.5587][E-21530][T-04][WORKING] 1 pastèque en préparation (4s)
[1542564515.562175][E-21530][T-04][OUT] 1 pastèque prête envoyée
[1542564515.5661][E-21530][T-01][IN] 1 pêche à préparer reçue
[1542564515.566198][E-21530][T-01][WORKING] 1 pêche en préparation (3s)
[1542564518.567733][E-21530][T-01][OUT] 1 pêche prête envoyée
[1542564518.571221][E-21530][T-00][IN] 1 cerise à préparer reçue
[1542564518.571289][E-21530][T-00][WORKING] 1 cerise en préparation (1s)
[1542564519.572394][E-21530][T-00][OUT] 1 cerise prête envoyée
  </div>

  <div id="messages-header">
    <div class="container">
        <h2>Maître</h2>
    </div>
    <div class="container">
        <h2>Esclaves</h2>
    </div>
  </div>
  <div id="messages"></div>

  <div id="footer">
  La salade est prête ! Bonne dégustation !<br>Temps de préparation : 21.1s
  </div>

  <div id="credits">
    Icônes de
    <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a>
    (CC 3.0 BY)
  </div>
body {
  background: #f7f7f7;
  color: #424242;
  font-size: 14px;
  font-family: Merriweather,Liberation Serif,Times New Roman,Times,Georgia,FreeSerif,serif;
}

h2 {
  margin: 0px;
}

#messages-header .container {
  display: inline-block;
  width: 49%;
  vertical-align: top;
  margin-bottom: 20px;
}

#messages-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: normal;
  color: #084460;
  width: 80%;
  border-bottom: 1px dashed #084460;
}

*[id$="-messages"] {
  display: none;
}

#messages {
  max-height: 350px;
  overflow: auto;
}

.message {
  width: 45%;
  display: flex;
}

.message.slaves {
  position: relative;
  left: 50%;
}

.message.active {
  color: #ea9408;
}

.message div {
  display: inline-block;
  vertical-align: middle;
}

.message .text {
  flex-grow: 1;
}

.message .label {
  font-size: 20px;
  width: 20px;
  margin-right: 10px;
  font-weight: bold;
  position: relative;
  top: -4px;
  text-align: center;
}

#footer {
  border-top: 1px dashed #084460;
  margin: 15px auto 0 auto;
  padding: 15px 5px 0 5px;
  width: 300px;
  text-align: center;
}

.emoji {
  position: relative;
  top: 2px;
}

#credits {
  text-align: right;
  margin-top: 10px;
  font-size: 11px;
}

#credits a {
  color: #084460;
}