# Run Logstash manually without interrupting logstash service and logstash Scheduler

**URL:** <https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036>\
**Category:** Logstash\
**Created:** [February 21, 2023, 8:20am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036 "2023-02-21T08:20:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [February 21, 2023, 8:20am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/1 "2023-02-21T08:20:27Z")

</div>

Hello,

I have a configuration file with http\_poller plugins, where I have some scheduler which on the given schedule pull the data and enter it into my elastic db.

But to manually run lagstash instantly, What I have to do is reschdule the scheduler to the current time in my config file, then stop the auto service and then run the logstash file from command prompt.

What I want is, is there a way that without interrupting the config file schedule and without stopping the auto service I can run the configuration instantly???

My config below:

```auto
input {
    http_poller {
	id => "test-plugin"
    urls => {
	test_api => {
        method => "POST"
        url => "api url"
		headers => {
                    "Content-Type" => "application/json"
                }
      }
	}	
	request_timeout => 120
	schedule => {cron => "8 5 * * * UTC"}
	codec => "json"
	tags => ["test-api"]
  }
}
filter { 
	mutate {
		remove_field => ["[message]" ]
		remove_field => ["[@version]" ]
		remove_field => ["[event]" ]
	}
}
output {
	if "test-api" in [tags]
	{
		elasticsearch {
			id => "test-output"
			hosts => ["host1"]
			user => "user"
			password => "password"
			index => "my-index"
			document_id => "%{ID}"
			doc_as_upsert => true
			action => "update"
		 }
	}
}

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 21, 2023, 5:22pm UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/2 "2023-02-21T17:22:18Z")

</div>

You can run multiple copies of logstash provided they use different data directories. If you want to run the task immediately then instead of using a cronline use `schedule => "at now"`.

---

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [February 23, 2023, 10:21am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/3 "2023-02-23T10:21:07Z")

</div>

Thank You Badger.. But I cannot run this file manually without stopping the service. I do not want to stop the service.. Is there any way to do so???

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 23, 2023, 5:15pm UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/4 "2023-02-23T17:15:27Z")

</div>

Explicitly set --path.data to a different directory.

---

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [February 27, 2023, 7:11am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/5 "2023-02-27T07:11:07Z")

</div>

> [@Badger](#):
>
> schedule =\> "at now"

Hello Badger,

schedule =\> "at now" is not working.. giving an error....

```auto
 input {
    http_poller {
      # This setting must be a hash
      # This field must contain an even number of items, got 1
      schedule => "at now"
      ...
    }
  }

[2023-02-27T12:37:02,556][ERROR][logstash.agent] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: (ConfigurationError) Something is wrong with your configuration.", 

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 27, 2023, 5:14pm UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/6 "2023-02-27T17:14:29Z")

</div>

> [@Rakhshunda\_Noorein\_J](#):
>
> `schedule => "at now"`

[This thread](https://discuss.elastic.co/t/http-poller-run-once-and-terminate/163195/3) shows a user trying `schedule=> { "in" => 0 }` so I would suggest `schedule => { "at" => "now" }`.

---

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [February 28, 2023, 6:09am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/7 "2023-02-28T06:09:19Z")

</div>

> [@Badger](#):
>
> schedule =\> { "at" =\> "now" }

Hello badger,

This solution is not working.....

error:

```auto
 Plugin: <LogStash::Inputs::HTTP_Poller schedule=>{"at"=>"now"}, codec=><LogStash::Codecs::JSON id=>"json_8dcb0866-d4d0-48a7-9e81-f33de83cd040", enable_metric=>true, charset=>"UTF-8">, urls=>{"sector_api"=>{"headers"=>{"Content-Type"=>"application/json"}, "method"=>"POST", "body"=>"{\"SecretKey\":\"T8xmLetfdt3dlUiVayHwZK0q3nUsQ8zrS\"}", "url"=>"https://staging.stockedge.com/Api/GlobalSearchApi/GetSectorList"}}, request_timeout=>120, id=>"se-sector-input", tags=>["se-api-sector"], enable_metric=>true, socket_timeout=>10, connect_timeout=>10, follow_redirects=>true, pool_max=>50, pool_max_per_route=>25, keepalive=>true, automatic_retries=>1, retry_non_idempotent=>false, validate_after_inactivity=>200, keystore_type=>"JKS", ssl_verification_mode=>"full", truststore_type=>"JKS", cookies=>true, metadata_target=>"@metadata">
  Error: couldn't parse "now"
  Exception: ArgumentError

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 28, 2023, 4:53pm UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/8 "2023-02-28T16:53:11Z")

</div>

You are right, rufus does not support "at now". You will have to use "in 0". I have tested

```
input { http_poller { urls => { "first" => "http://www.google.com" } schedule => { in => 0 } codec => plain } }

```

and it works.

---

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [March 1, 2023, 6:25am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/9 "2023-03-01T06:25:43Z")

</div>

yes it is working..

Thank You badger.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 29, 2023, 6:26am UTC](https://discuss.elastic.co/t/run-logstash-manually-without-interrupting-logstash-service-and-logstash-scheduler/326036/10 "2023-03-29T06:26:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
