# Splitting multiple strings into subfields

**URL:** <https://discuss.elastic.co/t/splitting-multiple-strings-into-subfields/247549>\
**Category:** Logstash\
**Created:** [September 4, 2020, 1:46pm UTC](https://discuss.elastic.co/t/splitting-multiple-strings-into-subfields/247549 "2020-09-04T13:46:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ds2000](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@ds2000](https://discuss.elastic.co/u/ds2000)\
**Post date:** [September 4, 2020, 1:46pm UTC](https://discuss.elastic.co/t/splitting-multiple-strings-into-subfields/247549/1 "2020-09-04T13:46:23Z")

</div>

Hi all,  
I'm not sure if this is possible or not. I'm collecting a lot of data and collecting it into a single line in a logfile.

For reference, this is the pre-log format

moduleName1  
----- InstalledVersion  
----- NewVersion  
----- Dependencies  
---------- Dependency1  
-------------pass/fail  
-------------versionGT  
-------------versionLT

moduleName2  
----- InstalledVersion  
----- NewVersion  
----- Dependencies  
---------- DependencyName  
-------------pass/fail  
-------------versionGT  
-------------versionLT  
---------- DependencyName  
-------------pass/fail  
-------------versionGT  
-------------versionLT  
---------- DependencyName  
-------------pass/fail  
-------------versionGT  
-------------versionLT

Logged results take the following format:

`puppet-windowsfeature,3.2.2,3.2.2;puppet-archive,puppet/archive,0.4.4,4.4.0,pass;5.0.0,pass; choria-mcollective_agent_puppet,2.3.2,2.3.3;puppetlabs-stdlib,puppetlabs/stdlib,4.22.0,6.1.0,pass;7.0.0,pass;puppetlabs-stdlib,puppetlabs/stdlib,4.22.0,6.1.0,pass;7.0.0,pass;`

So after the first three fields in the source message I have split on a ; to indicate the the start of the dependencies

If there is only one dependency then its easy:  
`(?<module_name>[^,]*),(?<installed_version>[^,]*),(?<latest_release>[^,]*);%{GREEDYDATA:dependencies}`

However, I'd like to create the same fields for each dependency, whether thats dep1\_DependencyName, dep1\_result, dep2\_DependencyName, dep21\_result etc.

The idea is to create a dashboard that presents our installed modules, whether there is an update available, and if so, whether dependencies are met.

Thanks,

Dave

---

<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:** [October 2, 2020, 1:46pm UTC](https://discuss.elastic.co/t/splitting-multiple-strings-into-subfields/247549/2 "2020-10-02T13:46:28Z")

</div>

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