/** * Submits an event to this index through an HTTP POST request. * * @param args Optional arguments for this request. Valid parameters are: * "host", "host_regex", "source", and "sourcetype". * @param data The event data to post. */ public void submit(Args args, String data) { Receiver receiver = service.getReceiver(); receiver.submit(getName(), args, data); }
/** * Submits an event to this index through an HTTP POST request. * * @param data The event data to post. */ public void submit(String data) { Receiver receiver = service.getReceiver(); receiver.submit(getName(), data); }
/** * Creates a writable socket to this index. * * @return The writable socket. * @throws IOException */ public Socket attach() throws IOException { Receiver receiver = service.getReceiver(); return receiver.attach(getName()); }
/** * Creates a writable socket to this index. * * @param args Optional arguments for this stream. Valid parameters are: * "host", "host_regex", "source", and "sourcetype". * @return The socket. * @throws IOException */ public Socket attach(Args args) throws IOException { Receiver receiver = service.getReceiver(); return receiver.attach(getName(), args); }
/** * Uploads a file to this index as an event stream. * <p> * <b>Note:</b> This file must be directly accessible by the Splunk server. * * @param filename The path and filename. */ public void upload(String filename) { EntityCollection<Upload> uploads = service.getUploads(); Args args = new Args("index", getName()); uploads.create(filename, args); }
/** * Uploads a file to this index as an event stream. * <p> * <b>Note:</b> This file must be directly accessible by the Splunk server. * * @param filename The path and filename. * * @param args Optional arguments for this request. Valid parameters are: * "host", "sourcetype", "rename-source". More found at: * http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTinput#data.2Finputs.2Foneshot * */ public void upload(String filename, Args args) { EntityCollection<Upload> uploads = service.getUploads(); if(args.containsKey("index")){ throw new IllegalArgumentException("The 'index' parameter cannot be passed to an index's oneshot upload."); } args.add("index", getName()); uploads.create(filename, args); } }