<commit_before>package org.graylog2;

import org.json.simple.JSONValue;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
import java.util.zip.GZIPOutputStream;

public class GelfMessage {

    public static final int MAXIMUM_CHUNK_SIZE = 1420;
    public static final String GELF_VERSION = "1.0";
    public static final byte[] GELF_CHUNKED_ID = new byte[]{0x1e, 0x0f};

    private static final String ID_NAME = "id";

    private String version = GELF_VERSION;
    private String host;
    private String shortMessage;
    private String fullMessage;
    private Long timestamp;
    private String level;
    private String facility = "gelf-java";
    private String line;
    private String file;
    private Map<String, Object> additonalFields = new HashMap<String, Object>();

    public GelfMessage() {
    }

    public GelfMessage(String shortMessage, String fullMessage, Date timestamp, String level) {
        this.shortMessage = shortMessage;
        this.fullMessage = fullMessage;
        this.timestamp = timestamp.getTime() / 1000L;
        this.level = level;
    }

    public GelfMessage(String shortMessage, String fullMessage, Long timestamp, String level) {
        this.shortMessage = shortMessage;
        this.fullMessage = fullMessage;
        this.timestamp = timestamp;
        this.level = level;
    }

    public GelfMessage(String shortMessage, String fullMessage, Long timestamp, String level, String line, String file) {
        this.shortMessage = shortMessage;
        this.fullMessage = fullMessage;
        this.timestamp = timestamp;
        this.level = level;
        this.line = line;
        this.file = file;
    }

    public String toJson() {
        HashMap<String, Object> map = new HashMap<String, Object>();

        map.put("version", getVersion());
        map.put("host", getHost());
        map.put("short_message", getShortMessage());
        map.put("full_message", getFullMessage());
        map.put("timestamp", getTimestamp().intValue());

        map.put("level", getLevel());
        map.put("facility", getFacility());
        map.put("file", getFile());
        map.put("line", getLine());

        for (String additionalField : additonalFields.keySet()) {
            if (ID_NAME.equals(additionalField)) continue;
            Object value = additonalFields.get(additionalField);
            map.put("_" + additionalField, value);
        }<commit_msg>Fixing the timestamp to be seconds instead of milliseconds.<commit_after>package org.graylog2;

import org.json.simple.JSONValue;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
import java.util.zip.GZIPOutputStream;

public class GelfMessage {

    public static final int MAXIMUM_CHUNK_SIZE = 1420;
    public static final String GELF_VERSION = "1.0";
    public static final byte[] GELF_CHUNKED_ID = new byte[]{0x1e, 0x0f};

    private static final String ID_NAME = "id";

    private String version = GELF_VERSION;
    private String host;
    private String shortMessage;
    private String fullMessage;
    private Long timestamp;
    private String level;
    private String facility = "gelf-java";
    private String line;
    private String file;
    private Map<String, Object> additonalFields = new HashMap<String, Object>();

    public GelfMessage() {
    }

    public GelfMessage(String shortMessage, String fullMessage, Date timestamp, String level) {
        this.shortMessage = shortMessage;
        this.fullMessage = fullMessage;
        this.timestamp = timestamp.getTime() / 1000L;
        this.level = level;
    }

    public GelfMessage(String shortMessage, String fullMessage, Long timestamp, String level) {
        this.shortMessage = shortMessage;
        this.fullMessage = fullMessage;
        this.timestamp = timestamp;
        this.level = level;
    }

    public GelfMessage(String shortMessage, String fullMessage, Long timestamp, String level, String line, String file) {
        this.shortMessage = shortMessage;
        this.fullMessage = fullMessage;
        this.timestamp = timestamp / 1000L;
        this.level = level;
        this.line = line;
        this.file = file;
    }

    public String toJson() {
        HashMap<String, Object> map = new HashMap<String, Object>();

        map.put("version", getVersion());
        map.put("host", getHost());
        map.put("short_message", getShortMessage());
        map.put("full_message", getFullMessage());
        map.put("timestamp", getTimestamp().intValue());

        map.put("level", getLevel());
        map.put("facility", getFacility());
        map.put("file", getFile());
        map.put("line", getLine());

        for (String additionalField : additonalFields.keySet()) {
            if (ID_NAME.equals(additionalField)) continue;
            Object value = additonalFields.get(additionalField);
            map.put("_" + additionalField, value);
        }
{'fraction_non_alphanumeric': 0.10679230467216333, 'fraction_numerical': 0.006674519042010208, 'mean_word_length': 3.072741806554756, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2756178', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1379, 'n_words': 375}