# Logstash - Reading files from Windows Network Share

**URL:** https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105
**Category:** Logstash
**Tags:** windows
**Created:** [December 13, 2022, 9:24am UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105 "2022-12-13T09:24:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![anon99430464](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@anon99430464](https://discuss.elastic.co/u/anon99430464)
#### Post date: [December 13, 2022, 9:24am UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105/1 "2022-12-13T09:24:57Z")

</div>

I'm trying to read log files from a network share on Windows. I know this isn't best practice, but currently there is no way around it, and from the documentation it sounds like it is supported.

However I can not get this working. In the trace log I always get that 0 files are found.

> [2022-12-13T10:23:52,832][TRACE][filewatch.discoverer][main][e67bc34fb15be8fb610b8ac1ec20f025b05bf85e339b9399c18f5e5b87a23c75] discover\_files {:count=\>0}

I have tried the following in the config file:

```auto
input {
	file {
		path => 
		[
			"W:/application1/test.log", #mapped network drive
			"W:\application1\test.log", #mapped network drive
			"\\server1\logs\application1\test.log",
			"\\server1/logs/application1/test.log",
		]
	}
}

```

Any ideas, suggestions?

I have noticed there are a couple of topics on this issue, but none of them have an answer:

> [@Logstash (Running as Windows Service) - cannot obtain logs from Windows Network Drive](https://discuss.elastic.co/t/logstash-running-as-windows-service-cannot-obtain-logs-from-windows-network-drive/288290):
>
> Hi Everyone, I'm having issue to get Logstash to send logs from Windows network drive while running it as Windows Service (using NSSM), it works perfectly fine using the CLI. Here's the logstash.conf: input { file { path =\> "c:/sample.log" path =\> "c:/networklog/sample.log" path =\> "//sample-test-winvm-002/networkdrive/location1/sample.log" # path =\> "//10.0.0.22/networkdrive/location1/sample.log" # path =\> "z:/location1/sample.log" } } From the debug logs, I can see the fol…

> [@How to specify an UNC-Path (network share) for logstash file input plugin](https://discuss.elastic.co/t/how-to-specify-an-unc-path-network-share-for-logstash-file-input-plugin/316900):
>
> Hello, I tried specifying a UNC-Path for the "path"-Setting of the logstash file input plugin and unfortunately it doesn't work. Is this a known issue or does someone here know how to get this to work on a windows maschine? Here's what I've tried so far: path =\> ["\\PC-NAME\share\file.txt"] path =\> ["\\\\PC-NAME\\share\\file.txt"] path =\> ["\\\\\\\\PC-NAME\\\\share\\\\file.txt"] path =\> ["PC-NAME\share\file.txt"] path =\> ["PC-NAME/share/file.txt"] path =\> ["/PC-NAME/share/file.txt"] path =\> …

Thank you

---

<div class="post-metadata">

### Author: ![simon137](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@simon137](https://discuss.elastic.co/u/simon137)
#### Post date: [December 13, 2022, 10:30am UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105/2 "2022-12-13T10:30:19Z")

</div>

I think it simply just doesn't work.. even though the docs say it should work.

At least I couldn't get it to work. I even filed a bug report on github for the file-input plugin, but it hasn't received any attention so far.

> <https://github.com/logstash-plugins/logstash-input-file/issues/316>
>
> \*\*Logstash information\*\*:
> 
> Please include the following information:
> 
> 1. Log…stash version: 8.4.3
> 2. Logstash installation source: extracted from the official zip archive
> 3. How is Logstash being run: windows service
> 4. How was the Logstash Plugin installed: plugin was not installed seperately
> 
> \*\*JVM\*\* (e.g. \`java -version\`): Bundled JDK: OpenJDK 64-Bit Server VM 17.0.4+8 on 17.0.4+8 +indy +jit \[x86\_64-mswin32\]
> 
> \*\*OS version\*\* (\`uname -a\` if on a Unix-like system): Windows 10
> 
> \*\*Description of the problem including expected versus actual behavior\*\*:
> 
> Specifying a UNC-Path (windows network share) for the "path"-Setting of the logstash file input plugin doesn't work. In most of the cases the pipeline just starts and does nothing, in a few cases an error is thrown, that absolute paths are not allowed, which makes sense, but I wanted to try anyway
> 
> Here's what I've tried so far:
> 
> path =\> \["\\\\PC-NAME\\share\\file.txt"\]
> path =\> \["\\\\\\\\PC-NAME\\\\share\\\\file.txt"\]
> path =\> \["\\\\\\\\\\\\\\\\PC-NAME\\\\\\\\share\\\\\\\\file.txt"\]
> path =\> \["PC-NAME\\share\\file.txt"\]
> path =\> \["PC-NAME/share/file.txt"\]
> path =\> \["/PC-NAME/share/file.txt"\]
> path =\> \["//PC-NAME/share/file.txt"\]
> path =\> \["////PC-NAME//share//file.txt"\]
> path =\> \["file://///PC-NAME/share/file.txt"\] 
> 
> The last one works on windows also in the browser for example.
> 
> \*\*Steps to reproduce\*\*:
> 
> Just specify a UNC-Path in the path-setting of the file-input plugin with an empty filter and output to elasticsearch or stdout to check if it reads the file. It works perfetly for local paths like this: \`C:/share/file.txt\` but not for UNC-Paths.
> 
> see also here: \[https://discuss.elastic.co/t/how-to-specify-an-unc-path-network-share-for-logstash-file-input-plugin/316900)\](https://discuss.elastic.co/t/how-to-specify-an-unc-path-network-share-for-logstash-file-input-plugin/316900)

---

<div class="post-metadata">

### Author: ![anon99430464](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@anon99430464](https://discuss.elastic.co/u/anon99430464)
#### Post date: [December 13, 2022, 1:15pm UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105/3 "2022-12-13T13:15:31Z")

</div>

> [@simon137](#):
>
> I think it simply just doesn't work.. even though the docs say it should work.

That's sad to hear, I hope somebody can give some clarity on this issue. What did you end up doing as an alternative?

---

<div class="post-metadata">

### Author: ![simon137](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@simon137](https://discuss.elastic.co/u/simon137)
#### Post date: [December 13, 2022, 1:44pm UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105/4 "2022-12-13T13:44:43Z")

</div>

We eventually just decided to use another technology for the specific use case the pipeline was initially set up to handle. We ended up writing a program in C# to replace the logstash pipeline.

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [December 14, 2022, 7:05am UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105/5 "2022-12-14T07:05:50Z")

</div>

Only this could work: "W:/application1/test.log"  
Writing C#? You can make a script to tail&copy log on the local drive.

---

<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: [January 11, 2023, 7:05am UTC](https://discuss.elastic.co/t/logstash-reading-files-from-windows-network-share/321105/6 "2023-01-11T07:05:56Z")

</div>

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