> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://mezmo.ferndocs.com/api-reference/log-analysis/ingestion/ingest/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mezmo.ferndocs.com/_mcp/server. # Send Log Lines POST https://logs.mezmo.com/logs/ingest Content-Type: application/json Use this method to send logs to a logging instance. ### Authentication You can find instructions on authentication [here](/log-analysis-api/ref#authentication). Ingestion is similar to the other APIs, but instead of `servicekey` you will use `apikey` if you are using the header style authentication. ### Metadata Meta is a field reserved for custom information associated with a log line. To add metadata to an API call, specify the `meta` field under the lines object. Metadata can be viewed inside that line's context WARNING: If inconsistent value types are used, that line's metadata, will not be parsed. For example, if a line is passed with a meta object, such as `meta.myfield` of type String, any subsequent lines with `meta.myfield` must have a String as the value type for `meta.myfield`. > Please be aware of [service limits](https://docs.mezmo.com/docs/Mezmo-ingestion-service-limits) > on this endpoint Reference: https://mezmo.ferndocs.com/api-reference/log-analysis/ingestion/ingest ## Authentication - `apikey` header (required) — (Deprecated) This key is used for ingestion. You can obtain it following [these instructions](https://docs.mezmo.com/docs/ingestion-key) and placing the key in the header of your call. *NOTE* Usage of the apikey auth mechanism has been deprecated in favor of IAM Access Tokens. Service keys can no longer be created, but can still be used for v1 and v2 apis while the transition takes place - `Authorization` header (basic auth, required) — (Deprecated) As an alternative to authenticating with a header value, you can also use basic authentication. To use either `apiKey` or `servicekey` as basic authentication, simply pass the key as the username with no password. For example: ``` curl https://api.logdna.com/v1/config/view -u INSERT_API_KEY: ``` ## Request ### Query parameters - `hostname` (string, required) — Host name of the source. - `mac` (string, optional) — The network mac address of the host computer. - `ip` (string, optional) — The local IP address of the host computer. - `now` (string, optional) — The source UNIX timestamp in milliseconds at the time of the request. Used to calculate time drift. - `tags` (string, optional) — Tags that are used to dynamically group hosts. ### Body (application/json) This endpoint expects an ingestlines. - `lines` (list of IngestlinesLinesItems, optional) ## Response ### 200 OK - `map from string to LogsIngestPostResponsesContentApplicationJsonSchema` ## Types ### IngestlinesLinesItems - `line` (string, required) — Text of the log line. - `timestamp` (string, optional) — UNIX timestamp, including milliseconds, when the log entry was recorded. - `app` (string, optional) — Name of the application that generates the log line. - `level` (string, optional) — Set a value for the level. For example, sample values for this parameter are INFO, WARNING, ERROR. - `meta` (string, optional) — This field is reserved for custom information that is associated with a log line. To add metadata to an API call, specify the meta field under the lines object. Metadata can be viewed inside that line's context. ### LogsIngestPostResponsesContentApplicationJsonSchema ## Examples **Request** ```json {} ``` **Response** ```json {} ``` **SDK Code** ```python import requests url = "https://logs.mezmo.com/logs/ingest" querystring = {"hostname":"hostname"} payload = {} headers = { "apikey": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://logs.mezmo.com/logs/ingest?hostname=hostname'; const options = { method: 'POST', headers: {apikey: '', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://logs.mezmo.com/logs/ingest?hostname=hostname" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("apikey", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://logs.mezmo.com/logs/ingest?hostname=hostname") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["apikey"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://logs.mezmo.com/logs/ingest?hostname=hostname") .header("apikey", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://logs.mezmo.com/logs/ingest?hostname=hostname', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'apikey' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://logs.mezmo.com/logs/ingest?hostname=hostname"); var request = new RestRequest(Method.POST); request.AddHeader("apikey", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "apikey": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://logs.mezmo.com/logs/ingest?hostname=hostname")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```