├── .gitattributes ├── .github └── workflows │ ├── Tests.yml │ └── codeql-analysis.yml ├── .gitignore ├── LICENSE ├── README.md ├── SECURITY.md ├── docker-compose.yml ├── logstash ├── Dockerfile ├── f5-patterns.yml ├── logstash-config │ ├── dictionaries │ │ └── f5-syslogpriorities.yml │ ├── logstash.yml │ ├── patterns │ │ └── f5-syslogpatterns.yml │ ├── pipeline │ │ ├── f5-syslog │ │ │ └── f5-syslog.conf │ │ ├── generic-json-udp │ │ │ └── generic-json.conf │ │ ├── generic-json │ │ │ ├── generic-json.conf │ │ │ ├── input.conf │ │ │ └── output.conf │ │ └── netflow │ │ │ ├── filter.conf │ │ │ ├── input.conf │ │ │ └── output.conf │ └── pipelines.yml ├── supervisor-config │ └── supervisord.conf └── tests │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── f5-syslog.spec.ts │ ├── generic-json.spec.ts │ └── helpers │ │ └── index.ts │ └── tsconfig.json ├── media ├── logstash pipeline tester.drawio.xml ├── pipeline-tester-diagram.png └── screenshot.png └── pipeline-ui ├── .dockerignore ├── Dockerfile ├── backend ├── .eslintrc.js ├── package-lock.json ├── package.json ├── src │ ├── api │ │ └── v1 │ │ │ ├── logstashStatus │ │ │ └── index.ts │ │ │ ├── pipelines │ │ │ ├── getpipelines.ts │ │ │ └── index.ts │ │ │ ├── receiveLogstashOutput │ │ │ └── index.ts │ │ │ └── sendLogLines │ │ │ ├── index.ts │ │ │ ├── sendTCPString.ts │ │ │ └── sendUDPString.ts │ ├── constants │ │ ├── LogstashAddress.ts │ │ ├── PipelineDirectory.ts │ │ └── config.ts │ ├── index.ts │ ├── interfaces.ts │ └── util │ │ └── Logger.ts └── tsconfig.json ├── frontend ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── browserconfig.xml │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── index.html │ ├── logo.png │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ ├── mstile-144x144.png │ ├── mstile-150x150.png │ ├── mstile-310x150.png │ ├── mstile-310x310.png │ ├── mstile-70x70.png │ ├── robots.txt │ ├── safari-pinned-tab.svg │ └── site.webmanifest ├── src │ ├── App.css │ ├── App.test.tsx │ ├── App.tsx │ ├── Assets │ │ └── Icons │ │ │ ├── BackendIcon.tsx │ │ │ ├── HelpIcon.tsx │ │ │ └── LogstashIcon.tsx │ ├── Components │ │ ├── BackendStatus │ │ │ └── BackendStatus.tsx │ │ ├── GeneralHelp │ │ │ └── GeneralHelp.tsx │ │ ├── HelpPopups │ │ │ └── HelpPopups.tsx │ │ ├── InputPort │ │ │ └── InputPort.tsx │ │ ├── InputTextarea │ │ │ └── LogstashLogLines.tsx │ │ ├── LogstashStatus │ │ │ └── LogstashStatus.tsx │ │ ├── Result │ │ │ └── Result.tsx │ │ ├── SelectPipeline │ │ │ └── SelectPipeline.tsx │ │ ├── SelectProtocol │ │ │ └── SelectProtocol.tsx │ │ └── ToggleMinify │ │ │ └── ToggleMinify.tsx │ ├── Interfaces │ │ └── CommonInterfaces.ts │ ├── Layout │ │ └── Menu │ │ │ └── Menu.tsx │ ├── Util │ │ ├── Backend.ts │ │ ├── ConnectBackend.ts │ │ └── ValidatePortInput.ts │ ├── index.css │ ├── index.tsx │ ├── logo.svg │ ├── pipeline-ui.css │ ├── react-app-env.d.ts │ ├── serviceWorker.ts │ └── setupTests.ts └── tsconfig.json └── integration-tests ├── cypress.config.js ├── cypress ├── e2e │ └── integration-test.cy.js ├── fixtures │ └── example.json ├── plugins │ └── index.js └── support │ ├── commands.js │ └── e2e.js ├── package-lock.json └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/workflows/Tests.yml: -------------------------------------------------------------------------------- 1 | name: Test build and linting 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | lint-backend: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: actions/setup-node@v2 11 | with: 12 | node-version: '16' 13 | - name: npm install 14 | working-directory: ./pipeline-ui/backend 15 | run: npm install 16 | - name: Lint 17 | working-directory: ./pipeline-ui/backend 18 | run: npm run lint 19 | lint-frontend: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: actions/checkout@v2 23 | - uses: actions/setup-node@v2 24 | with: 25 | node-version: '16' 26 | - name: npm install 27 | working-directory: ./pipeline-ui/frontend 28 | run: npm install 29 | - name: Lint 30 | working-directory: ./pipeline-ui/frontend 31 | run: npm run lint 32 | integration-and-unit-tests: 33 | timeout-minutes: 15 34 | runs-on: ubuntu-latest 35 | steps: 36 | - uses: actions/checkout@v2 37 | - uses: actions/setup-node@v2 38 | with: 39 | node-version: '16' 40 | - name: Start containers 41 | run: docker compose -f "docker-compose.yml" up -d --build 42 | - name: npm install 43 | working-directory: ./pipeline-ui/integration-tests 44 | run: npm install 45 | - name: Cypress run 46 | uses: cypress-io/github-action@v4 47 | with: 48 | working-directory: pipeline-ui/integration-tests 49 | wait-on: 'http://localhost:8080' 50 | - name: npm install 51 | working-directory: logstash/tests 52 | run: npm install 53 | - name: Run tests 54 | working-directory: logstash/tests 55 | run: npm run test 56 | - name: Stop containers 57 | if: always() 58 | run: docker compose -f "docker-compose.yml" down 59 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '25 12 * * 3' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | language: [ 'javascript' ] 32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 33 | # Learn more: 34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v2 39 | 40 | # Initializes the CodeQL tools for scanning. 41 | - name: Initialize CodeQL 42 | uses: github/codeql-action/init@v3 43 | with: 44 | languages: ${{ matrix.language }} 45 | # If you wish to specify custom queries, you can do so here or in a config file. 46 | # By default, queries listed here will override any specified in a config file. 47 | # Prefix the list here with "+" to use these queries and those in the config file. 48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 49 | 50 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 51 | # If this step fails, then you should remove it and run the build manually (see below) 52 | - name: Autobuild 53 | uses: github/codeql-action/autobuild@v3 54 | 55 | # ℹ️ Command-line programs to run using the OS shell. 56 | # 📚 https://git.io/JvXDl 57 | 58 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 59 | # and modify them (or add more) to build your code if your project 60 | # uses a compiled language 61 | 62 | #- run: | 63 | # make bootstrap 64 | # make release 65 | 66 | - name: Perform CodeQL Analysis 67 | uses: github/codeql-action/analyze@v3 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | **/build 4 | pipeline-ui/integration-tests/cypress/videos 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | This started out as a way to make it easy to test the logstash configuration for people without much linux know-how (and from my own frustration with how hard it was). Then it kind of grew into an interface, and here we are. 3 | 4 | It's written fast and the code could use a bit of additional love, but it works fine. 5 | 6 | # How to start 7 | Documentation on how to get going is available here: 8 | https://loadbalancing.se/2020/03/11/logstash-pipeline-tester/ 9 | 10 | There's also a video of how to get started here: 11 | https://youtu.be/Q3IQeXWoqLQ 12 | 13 | Article is dated 2020 but is continously updated whenever there is need to do so. 14 | 15 | # Contribute 16 | I gladly accept pull requests. If you have a pipeline you'd like to share/contribute that'd be great too. 17 | If you don't know how to do forking and pull requests I can handle that part, just let me know via an issue 18 | or dig up my contact details [here](https://loadbalancing.se/about/). 19 | 20 | ## Contributing to the application (express/React) 21 | If you want to to develop the application you'll need a local development environment 22 | on your client. Follow these steps to get started: 23 | 24 | 1. Find the IP of your machine with ie `ifconfig` or `ip addr` 25 | 2. Run `export BACKEND_IP=192.168.1.10` where `192.168.1.10` is your main IP if the client 26 | 3. Start logstash with `BACKEND_ENDPOINT=http://${BACKEND_IP}:8080/api/v1/receiveLogstashOutput docker compose up logstash` 27 | 28 | *Note that some flavors uses `docker compose` instead of `docker-compose`* 29 | 4. In another terminal, start backend with `cd pipeline-ui/backend; npm run dev` 30 | 5. In yet another terminal, start frontend with `cd pipeline-ui/frontend` 31 | 32 | Now you can update the code freely and both backend and frontend should refresh automatically. 33 | 34 | ## Reporting issues 35 | First, please check if there's any [current issues](https://github.com/epacke/logstash-pipeline-tester/issues) that matches your problem. If not, please feel free to submit an issue here at Github. 36 | 37 | I have very limited time so I won't be able to act fast on any issue but it's always good to have it logged and who knows, maybe someone else will pick it up and make a PR. 38 | 39 | # Application component diagram 40 |

41 | 42 | # Screenshots 43 |

44 | 45 | # Credits 46 | * F5 Example pipeline copied (and slightly modified) from [here](https://github.com/OutsideIT/logstash_filter_f5) 47 | 48 | ## Icons/media 49 | https://www.svgrepo.com/svg/289194/log-wood 50 | Wood Logs Vectors by Vecteezy 51 | 52 | ## Great tool for cleaning up SVGs 53 | https://iconly.io/tools/svg-cleaner 54 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | There are no specific versions being supported except for the latest one. 6 | Keep your repository up to date to keep up with the latest patches/fixes. 7 | 8 | ## Reporting a Vulnerability 9 | 10 | Use this section to tell people how to report a vulnerability. 11 | 12 | You can report security issues by opening up an [issue](https://github.com/epacke/logstash-pipeline-tester/issues). 13 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | pipeline-ui: 3 | build: "./pipeline-ui" 4 | container_name: "config_tester" 5 | environment: 6 | LOG_LEVEL: warn 7 | ports: 8 | - "8080:8080" 9 | volumes: 10 | - "./logstash/logstash-config/pipeline:/usr/src/pipeline" 11 | logstash: 12 | build: "./logstash" 13 | container_name: "logstash" 14 | hostname: "logstash" 15 | environment: 16 | BACKEND_ENDPOINT: "${BACKEND_ENDPOINT:-http://pipeline-ui:8080/api/v1/receiveLogstashOutput}" 17 | ports: 18 | - "5245:5245" 19 | - "9600:9600" 20 | - "5060:5060" 21 | - "2055:2055/udp" 22 | volumes: 23 | - "./logstash/logstash-config/logstash.yml:/usr/share/logstash/config/logstash.yml" 24 | - "./logstash/logstash-config/pipelines.yml:/usr/share/logstash/config/pipelines.yml" 25 | - "./logstash/logstash-config/pipeline:/usr/share/logstash/pipeline" 26 | - "./logstash/logstash-config/dictionaries:/usr/share/logstash/dictionaries" 27 | - "./logstash/logstash-config/patterns:/usr/share/logstash/patterns" 28 | -------------------------------------------------------------------------------- /logstash/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM logstash:8.9.2 2 | 3 | USER root 4 | 5 | RUN apt update 6 | RUN apt install -y \ 7 | python3-pip \ 8 | supervisor 9 | 10 | COPY ./supervisor-config/supervisord.conf /etc/ 11 | 12 | # Remove the default config files and the pipelines 13 | # as these are mounted from the host instead 14 | RUN rm /usr/share/logstash/config/logstash.yml 15 | RUN rm /usr/share/logstash/config/pipelines.yml 16 | RUN rm -rf /usr/share/logstash/pipeline 17 | USER 1000 18 | 19 | ENTRYPOINT "supervisord" 20 | -------------------------------------------------------------------------------- /logstash/f5-patterns.yml: -------------------------------------------------------------------------------- 1 | HOSTNAMEUND \b(?:[_0-9A-Za-z][_0-9A-Za-z-]{0,62})(?:\.(?:[_0-9A-Za-z][_0-9A-Za-z-]{0,62}))*(\.?|\b) 2 | IPNA (?:%{IPV6}|%{IPV4}|N\/A) 3 | SCHEME (HTTPS?) 4 | F5SEQ ([a-z0-9]*:[0-9]) 5 | F5ID ([a-z0-9]*) -------------------------------------------------------------------------------- /logstash/logstash-config/dictionaries/f5-syslogpriorities.yml: -------------------------------------------------------------------------------- 1 | "0": emergency 2 | "8": emergency 3 | "16": emergency 4 | "24": emergency 5 | "32": emergency 6 | "40": emergency 7 | "48": emergency 8 | "56": emergency 9 | "64": emergency 10 | "72": emergency 11 | "80": emergency 12 | "88": emergency 13 | "96": emergency 14 | "104": emergency 15 | "112": emergency 16 | "120": emergency 17 | "128": emergency 18 | "136": emergency 19 | "144": emergency 20 | "152": emergency 21 | "160": emergency 22 | "168": emergency 23 | "176": emergency 24 | "184": emergency 25 | "1": alert 26 | "9": alert 27 | "17": alert 28 | "25": alert 29 | "33": alert 30 | "41": alert 31 | "49": alert 32 | "57": alert 33 | "65": alert 34 | "73": alert 35 | "81": alert 36 | "89": alert 37 | "97": alert 38 | "105": alert 39 | "113": alert 40 | "121": alert 41 | "129": alert 42 | "137": alert 43 | "145": alert 44 | "153": alert 45 | "161": alert 46 | "169": alert 47 | "177": alert 48 | "185": alert 49 | "2": critical 50 | "10": critical 51 | "18": critical 52 | "26": critical 53 | "34": critical 54 | "42": critical 55 | "50": critical 56 | "58": critical 57 | "66": critical 58 | "74": critical 59 | "82": critical 60 | "90": critical 61 | "98": critical 62 | "106": critical 63 | "114": critical 64 | "122": critical 65 | "130": critical 66 | "138": critical 67 | "146": critical 68 | "154": critical 69 | "162": critical 70 | "170": critical 71 | "178": critical 72 | "186": critical 73 | "3": error 74 | "11": error 75 | "19": error 76 | "27": error 77 | "35": error 78 | "43": error 79 | "51": error 80 | "59": error 81 | "67": error 82 | "75": error 83 | "83": error 84 | "91": error 85 | "99": error 86 | "107": error 87 | "115": error 88 | "123": error 89 | "131": error 90 | "139": error 91 | "147": error 92 | "155": error 93 | "163": error 94 | "171": error 95 | "179": error 96 | "187": error 97 | "4": warning 98 | "12": warning 99 | "20": warning 100 | "28": warning 101 | "36": warning 102 | "44": warning 103 | "52": warning 104 | "60": warning 105 | "68": warning 106 | "76": warning 107 | "84": warning 108 | "92": warning 109 | "100": warning 110 | "108": warning 111 | "116": warning 112 | "124": warning 113 | "132": warning 114 | "140": warning 115 | "148": warning 116 | "156": warning 117 | "164": warning 118 | "172": warning 119 | "180": warning 120 | "188": warning 121 | "5": notice 122 | "13": notice 123 | "21": notice 124 | "29": notice 125 | "37": notice 126 | "45": notice 127 | "53": notice 128 | "61": notice 129 | "69": notice 130 | "77": notice 131 | "85": notice 132 | "93": notice 133 | "101": notice 134 | "109": notice 135 | "117": notice 136 | "125": notice 137 | "133": notice 138 | "141": notice 139 | "149": notice 140 | "157": notice 141 | "165": notice 142 | "173": notice 143 | "181": notice 144 | "189": notice 145 | "6": informational 146 | "14": informational 147 | "22": informational 148 | "30": informational 149 | "38": informational 150 | "46": informational 151 | "54": informational 152 | "62": informational 153 | "70": informational 154 | "78": informational 155 | "86": informational 156 | "94": informational 157 | "102": informational 158 | "110": informational 159 | "118": informational 160 | "126": informational 161 | "134": informational 162 | "142": informational 163 | "150": informational 164 | "158": informational 165 | "166": informational 166 | "174": informational 167 | "182": informational 168 | "190": informational 169 | "7": debug 170 | "15": debug 171 | "23": debug 172 | "31": debug 173 | "39": debug 174 | "47": debug 175 | "55": debug 176 | "63": debug 177 | "71": debug 178 | "79": debug 179 | "87": debug 180 | "95": debug 181 | "103": debug 182 | "111": debug 183 | "119": debug 184 | "127": debug 185 | "135": debug 186 | "143": debug 187 | "151": debug 188 | "159": debug 189 | "167": debug 190 | "175": debug 191 | "183": debug 192 | "191": debug -------------------------------------------------------------------------------- /logstash/logstash-config/logstash.yml: -------------------------------------------------------------------------------- 1 | http.host: "0.0.0.0" 2 | -------------------------------------------------------------------------------- /logstash/logstash-config/patterns/f5-syslogpatterns.yml: -------------------------------------------------------------------------------- 1 | HOSTNAMEUND \b(?:[_0-9A-Za-z][_0-9A-Za-z-]{0,62})(?:\.(?:[_0-9A-Za-z][_0-9A-Za-z-]{0,62}))*(\.?|\b) 2 | IPNA (?:%{IPV6}|%{IPV4}|N\/A) 3 | SCHEME (HTTPS?) 4 | F5SEQ ([a-z0-9]*:[0-9]) 5 | F5ID ([a-z0-9]*) -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/f5-syslog/f5-syslog.conf: -------------------------------------------------------------------------------- 1 | input { 2 | tcp { 3 | port => 5245 # Listener port (tcp) 4 | type => syslog # Receive type 5 | } 6 | udp { 7 | port => 5245 # Listener port (udp) 8 | type => syslog # Receive type 9 | } 10 | } 11 | 12 | filter { 13 | 14 | mutate { 15 | replace => { "type" => "f5-syslog" } 16 | } 17 | 18 | grok { 19 | patterns_dir => "/usr/share/logstash/patterns" 20 | match => [ "message", "\A<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} (slot1\/)?%{HOSTNAMEUND:syslog_hostname} %{LOGLEVEL:syslog_severity} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}\Z" ] 21 | add_tag => "grok_f5" 22 | } 23 | translate { 24 | dictionary_path => [ "/usr/share/logstash/dictionaries/f5-syslogpriorities.yml" ] 25 | field => "syslog_pri" 26 | destination => "syslog_severity" 27 | } 28 | mutate { 29 | copy => { "type" => "dig_type" } 30 | # remove_field => [ "syslog_timestamp" ] 31 | } 32 | if [syslog_program] =~ /apd|apmd/ { 33 | grok { 34 | patterns_dir => "/usr/share/logstash/patterns" 35 | match => [ 36 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (%{NOTSPACE:f5_apd_policy}:)?%{F5ID:f5_session_id}: %{GREEDYDATA:f5_apd_message}\Z", 37 | "syslog_message", "\A%{F5SEQ:f5_message_id}: %{PROG:f5_apd_processor} %{GREEDYDATA:f5_apd_message}\Z", 38 | "syslog_message", "\A%{F5SEQ:f5_message_id}: %{GREEDYDATA:f5_apd_message}\Z" 39 | ] 40 | remove_tag => "grok_f5" 41 | add_tag => "grok_f5_apd" 42 | } 43 | if [f5_apd_processor] { 44 | grok { 45 | patterns_dir => "/usr/share/logstash/patterns" 46 | match => [ 47 | "f5_apd_message", "\Afunc: (\\)?\"%{WORD:f5_apd_function}\(\)(\\)?\" line: %{NUMBER:f5_apd_processor_line} Msg: %{GREEDYDATA:f5_apd_processor_message}\Z" 48 | ] 49 | remove_tag => "grok_f5_apd" 50 | add_tag => "grok_f5_apd_processor" 51 | } 52 | } 53 | else if [f5_session_id] { 54 | grok { 55 | patterns_dir => "/usr/share/logstash/patterns" 56 | match => [ 57 | "f5_apd_message", "\Afunc: \"%{WORD:f5_apd_function}\(\)\" line: %{NUMBER:f5_apd_processor_line} Msg: %{GREEDYDATA:f5_apd_processor_message}\Z", 58 | "f5_apd_message", "\ASession variable '%{NOTSPACE:f5_apd_session_var_name}' set to '%{GREEDYDATA:f5_apd_session_var_value}'\Z", 59 | "f5_apd_message", "\AAccess policy result: %{GREEDYDATA:f5_apd_policy_result}\Z", 60 | "f5_apd_message", "\A%{GREEDYDATA:f5_apd_message}\Z" 61 | ] 62 | overwrite => [ "f5_apd_message" ] 63 | remove_tag => "grok_f5_apd" 64 | add_tag => "grok_f5_apd_session" 65 | } 66 | } 67 | } 68 | else if [syslog_program] == "dcc" { 69 | grok { 70 | patterns_dir => "/usr/share/logstash/patterns" 71 | match => [ 72 | "syslog_message", "\A%{F5SEQ:f5_message_id}: \[%{WORD:f5_dcc_type}\] ((?Request) violations: %{GREEDYDATA:f5_dcc_violation}. )?((?Request blocked), violations: %{GREEDYDATA:f5_dcc_violation}. )?HTTP protocol compliance sub violations: %{GREEDYDATA:f5_dcc_http_violation}. Evasion techniques sub violations: %{GREEDYDATA:f5_dcc_evasion_violation}. Web services security sub violations: %{GREEDYDATA:f5_dcc_web_violation}. Virus name: %{GREEDYDATA:f5_dcc_virusname}. Support id: %{GREEDYDATA:f5_dcc_support_id}, source ip: %{IPNA:f5_dcc_source_ip}, xff ip: %{IPNA:f5_dcc_xff_ip}, source port: %{NUMBER:f5_dcc_source_port}, destination ip: %{IPNA:f5_dcc_destination_ip}, destination port: %{NUMBER:f5_dcc_destination_port}, route_domain: %{NUMBER:f5_dcc_route_domain}, HTTP classifier: %{GREEDYDATA:f5_dcc_http_classifier}, scheme %{SCHEME:f5_dcc_scheme}, geographic location: \<%{GREEDYDATA:f5_dcc_geolocation}\>, request: \<%{GREEDYDATA:f5_dcc_request}\>, username: \<%{GREEDYDATA:f5_dcc_username}\>, session_id: \<%{GREEDYDATA:f5_dcc_session_id}\>\Z", 73 | "syslog_message", "\A%{F5SEQ:f5_message_id}: \[%{WORD:f5_dcc_type}\] (?Web scraping attack): %{WORD:f5_dcc_scraping_status}, HTTP classifier: %{GREEDYDATA:f5_dcc_http_classifier}, source ip %{IP:f5_dcc_source_ip}, route_domain: %{NUMBER:f5_dcc_route_domain}, geographic location: %{WORD:f5_dcc_geolocation}, operation mode: %{WORD:f5_dcc_operation_mode}, web scraping attack type: %{NOTSPACE:f5_dcc_scraping_type}, drop_counter = %{NUMBER:f5_dcc_drop_counter}, violation_counter = %{NUMBER:f5_dcc_violation_counter}, Transparent mode cshui injection ratio threshold = %{NUMBER:f5_dcc_injection_threshold}, Transparent mode cshui injection ratio = %{NUMBER:f5_dcc_injection_ratio}, Detected transactions on session = %{NUMBER:f5_dcc_detected_transactions}, Detected newly opened sessions from IP = %{NUMBER:f5_dcc_new_transactions}, Legitimate opened session = %{NUMBER:f5_dcc_legit_sessions}, %{GREEDYDATA:f5_dcc_rest}\Z", 74 | "syslog_message", "\A%{F5SEQ:f5_message_id}: Per-invocation log rate exceeded; (?throttling)\.\Z", 75 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (?Resuming log processing) at this invocation; held %{NUMBER:f5_dcc_logs_held} messages\.\Z" 76 | ] 77 | remove_tag => "grok_f5" 78 | add_tag => "grok_f5_dcc" 79 | } 80 | if [f5_dcc_violation] == "Web scraping attack" { 81 | mutate { 82 | add_field => { 83 | "f5_dcc_event" => "Scraping" 84 | } 85 | } 86 | } 87 | } 88 | else if [syslog_program] == "httpd" { 89 | grok { 90 | patterns_dir => "/usr/share/logstash/patterns" 91 | match => [ 92 | "syslog_message", "\A%{F5SEQ:f5_message_id}: AUDIT - user %{USERNAME:f5_httpd_user_name} - RAW: %{GREEDYDATA:f5_httpd_message}\Z", 93 | "syslog_message", "\A%{GREEDYDATA:f5_httpd_message}\Z" 94 | ] 95 | remove_tag => "grok_f5" 96 | add_tag => "grok_f5_httpd" 97 | } 98 | } 99 | else if [syslog_program] =~ /tmm.*/ { 100 | grok { 101 | patterns_dir => "/usr/share/logstash/patterns" 102 | match => [ 103 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (%{NOTSPACE:f5_tmm_policy}:)?%{F5ID:f5_session_id}: (?Session statistics) - bytes in: %{NUMBER:f5_tmm_session_bytes_in}, bytes out: %{NUMBER:f5_tmm_session_bytes_out}\Z", 104 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (%{NOTSPACE:f5_tmm_policy}:)?%{F5ID:f5_session_id}: (?Received client info) - (Hostname: (%{HOSTNAME:f5_tmm_client_hostname})? )?Type: %{HOSTNAME:f5_tmm_client_browser} Version: %{NUMBER:f5_tmm_client_browser_version} Platform: %{HOSTNAME:f5_tmm_client_platform} CPU: %{WORD:f5_tmm_client_cpu} UI Mode: %{GREEDYDATA:f5_tmm_client_ui_mode} Javascript Support: %{NUMBER:f5_tmm_client_javascript} ActiveX Support: %{NUMBER:f5_tmm_client_activex} Plugin Support: %{NUMBER:f5_tmm_client_plugin}\Z", 105 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (%{NOTSPACE:f5_tmm_policy}:)?%{F5ID:f5_session_id}: (?New session) from client IP %{IP:f5_tmm_session_client_ip} \(%{GREEDYDATA:f5_tmm_session_location}\) at VIP %{IP:f5_tmm_session_vip_ip} Listener %{GREEDYDATA:f5_tmm_session_listener} (\(Reputation=%{WORD:f5_tmm_reputation}\))?\Z", 106 | "syslog_message", "\A(?Rule) %{NOTSPACE:f5_tmm_rule} <%{NOTSPACE:f5_tmm_event}>: %{GREEDYDATA:f5_tmm_rule_message}\Z", 107 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (%{NOTSPACE:f5_tmm_policy}:)?%{F5ID:f5_session_id}: (?Session deleted) (due to %{GREEDYDATA:f5_tmm_session_deleted_reason})?((\()?%{GREEDYDATA:f5_tmm_session_deleted_reason}\))?\.\Z", 108 | "syslog_message", "\AAuthplatform %{MAVEN_VERSION:f5_tmm_auth_version} \(%{CISCO_REASON:f5_tmm_auth_type}\) %{NUMBER:f5_tmm_auth_id} %{IP:f5_tmm_auth_ip}:%{NUMBER:f5_tmm_auth_port} %{GREEDYDATA:f5_tmm_auth_message}\Z", 109 | "syslog_message", "\A%{F5SEQ:f5_message_id}: (%{NOTSPACE:f5_tmm_policy}:)?%{F5ID:f5_session_id}: %{GREEDYDATA:f5_tmm_message}\Z" 110 | ] 111 | remove_tag => "grok_f5" 112 | add_tag => "grok_f5_tmm" 113 | } 114 | if ([f5_tmm_rule_message] =~ /.+/) { 115 | grok { 116 | patterns_dir => "/usr/share/logstash/patterns" 117 | match => [ 118 | "f5_tmm_rule_message", "\AConnection to LDAP from following source: Client\(%{IP:f5_tmm_client_ip}\:%{NUMBER:f5_tmm_client_port}\) <-> \(%{IP:f5_tmm_server_ip}\:%{NUMBER:f5_tmm_server_port}\)Server\Z", 119 | "f5_tmm_rule_message", "\A%{GREEDYDATA:f5_tmm_rule_message}\Z" 120 | ] 121 | remove_tag => "grok_f5_tmm" 122 | add_tag => "grok_f5_tmm_rule" 123 | overwrite => [ "f5_tmm_rule_message" ] 124 | } 125 | } 126 | if [f5_tmm_message] == "User-Agent header is absent or empty" { 127 | mutate { 128 | add_field => { "f5_tmm_type" => "Missing User-Agent header" } 129 | } 130 | } 131 | } 132 | else if [syslog_program] =~ /sshd.*/ { 133 | grok { 134 | patterns_dir => "/usr/share/logstash/patterns" 135 | match => [ 136 | "syslog_message", "\AAccepted keyboard-interactive/pam for %{USERNAME:f5_ssh_username} from %{IP:f5_ssh_source_ip} port %{NUMBER:f5_ssh_source_port} ssh2", 137 | "syslog_message", "\Apam_unix(sshd:session): session opened for user %{USERNAME:f5_ssh_username} by (uid={USERNAME:f5_ssh_username_uid})", 138 | "syslog_message", "\Apam_unix(sshd:session): session closed for user %{USERNAME:f5_ssh_username}", 139 | "syslog_message", "\A%{PROG:f5_message_id}: AUDIT - user %{USERNAME:f5_ssh_username} - RAW: sshd\(pam_audit\): user=%{USERNAME}\(%{USERNAME}\) partition=\[%{WORD:f5_ssh_user_partition}] level=%{WORD:f5_ssh_user_level} tty=%{WORD} host=%{IP:f5_ssh_source_ip} attempts=%{INT:f5_ssh_user_attempts} start=\"%{HTTPDERROR_DATE:f5_ssh_session_start}\" end=\"%{HTTPDERROR_DATE:f5_ssh_session_end}\"\.\Z", 140 | "syslog_message", "\A%{GREEDYDATA:f5_ssh_message}" 141 | ] 142 | remove_tag => "grok_f5" 143 | add_tag => "grok_f5_sshd" 144 | } 145 | } 146 | } 147 | 148 | output { 149 | http { 150 | format => "json" 151 | http_method => "post" 152 | url => "${BACKEND_ENDPOINT:http://pipeline-ui:8080/api/v1/receiveLogstashOutput}" 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/generic-json-udp/generic-json.conf: -------------------------------------------------------------------------------- 1 | input { 2 | udp { 3 | port => 5080 # Listener port (udp) 4 | } 5 | } 6 | 7 | filter { 8 | json { 9 | source => "message" 10 | skip_on_invalid_json => true 11 | } 12 | mutate { 13 | add_field => { "token" => "abc1234" } 14 | remove_field => [ "message" ] 15 | } 16 | } 17 | 18 | output { 19 | http { 20 | format => "json" 21 | http_method => "post" 22 | url => "${BACKEND_ENDPOINT:http://pipeline-ui:8080/api/v1/receiveLogstashOutput}" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/generic-json/generic-json.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | filter { 4 | 5 | json { 6 | source => "message" 7 | skip_on_invalid_json => true 8 | } 9 | 10 | mutate { 11 | add_field => { "token" => "abc1234" } 12 | remove_field => [ "message" ] 13 | } 14 | 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/generic-json/input.conf: -------------------------------------------------------------------------------- 1 | input { 2 | tcp { 3 | port => 5060 # Listener port (tcp) 4 | } 5 | } -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/generic-json/output.conf: -------------------------------------------------------------------------------- 1 | output { 2 | http { 3 | format => "json" 4 | http_method => "post" 5 | url => "${BACKEND_ENDPOINT:http://pipeline-ui:8080/api/v1/receiveLogstashOutput}" 6 | } 7 | } -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/netflow/filter.conf: -------------------------------------------------------------------------------- 1 | filter {} 2 | -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/netflow/input.conf: -------------------------------------------------------------------------------- 1 | input { 2 | # Netflow 3 | udp { 4 | port => 2055 5 | codec => netflow { 6 | versions => [5,9,10] 7 | include_flowset_id => "true" 8 | } 9 | type => "netflow" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /logstash/logstash-config/pipeline/netflow/output.conf: -------------------------------------------------------------------------------- 1 | output { 2 | http { 3 | format => "json" 4 | http_method => "post" 5 | url => "${BACKEND_ENDPOINT:http://pipeline-ui:8080/api/v1/receiveLogstashOutput}" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /logstash/logstash-config/pipelines.yml: -------------------------------------------------------------------------------- 1 | # This file is where you define your pipelines. You can define multiple. 2 | # For more information on multiple pipelines, see the documentation: 3 | # https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html 4 | 5 | - pipeline.id: f5-syslog 6 | path.config: "/usr/share/logstash/pipeline/f5-syslog" 7 | - pipeline.id: generic-json 8 | path.config: "/usr/share/logstash/pipeline/generic-json" 9 | - pipeline.id: netflow 10 | path.config: "/usr/share/logstash/pipeline/netflow" 11 | -------------------------------------------------------------------------------- /logstash/supervisor-config/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [program:logstash] 5 | command=/usr/share/logstash/bin/logstash --config.reload.automatic 6 | user=1000 7 | stdout_logfile=/dev/fd/1 8 | stdout_logfile_maxbytes=0 9 | redirect_stderr=true 10 | killasgroup=true 11 | stopasgroup=true 12 | autorestart=true 13 | -------------------------------------------------------------------------------- /logstash/tests/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ 2 | module.exports = { 3 | preset: 'ts-jest', 4 | testEnvironment: 'node', 5 | testRegex: "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", 6 | }; -------------------------------------------------------------------------------- /logstash/tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tests", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest --runInBand", 8 | "dev:test": "jest --watch --runInBand" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@types/jest": "^27.5.2", 14 | "jest": "^29.7.0", 15 | "nodemon": "^3.0.1", 16 | "ts-jest": "^29.1.1", 17 | "ts-node": "^10.7.0", 18 | "typescript": "^4.6.2" 19 | }, 20 | "dependencies": { 21 | "axios": "^1.8.4", 22 | "ws": "^8.18.1" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /logstash/tests/src/f5-syslog.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Examples: 3 | <44>Mar 23 14:21:41 bigip.xip.se warning syslog-ng[2584]: WARNING: Default value changed for the prefix() option of systemd-journal source in syslog-ng 3.8; old_value='', new_value='.journald.' 4 | <30>Mar 23 14:23:01 bigip.xip.se info dhclient[4405]: XMT: Solicit on mgmt, interval 111970ms. 5 | <78>Mar 23 14:22:01 bigip.xip.se info CROND[23189]: (syscheck) CMD (/usr/bin/system_check -q) 6 | */ 7 | 8 | import { ProcessLogLine } from './helpers'; 9 | 10 | const sendF5 = async (message: string) => { 11 | const rawResponse = await ProcessLogLine(message, '5245', 'TCP'); 12 | return JSON.parse(rawResponse); 13 | } 14 | 15 | describe('F5 syslog tests', () => { 16 | it('Type should be f5-syslog', async () => { 17 | const data = await sendF5(`<44>Mar 23 14:21:41 bigip.xip.se warning syslog-ng[2584]: WARNING: Default value changed for the prefix() option of systemd-journal source in syslog-ng 3.8; old_value='', new_value='.journald.'`); 18 | const { type, syslog_hostname, syslog_severity, syslog_message, syslog_timestamp, syslog_program } = data; 19 | 20 | expect(type).toEqual('f5-syslog'); 21 | expect(syslog_hostname).toEqual('bigip.xip.se'); 22 | expect(syslog_severity).toEqual('warning'); 23 | expect(syslog_message).toEqual('WARNING: Default value changed for the prefix() option of systemd-journal source in syslog-ng 3.8; old_value=\'\', new_value=\'.journald.\''); 24 | expect(syslog_timestamp).toEqual('Mar 23 14:21:41'); 25 | expect(syslog_program).toEqual('syslog-ng'); 26 | }) 27 | }) -------------------------------------------------------------------------------- /logstash/tests/src/generic-json.spec.ts: -------------------------------------------------------------------------------- 1 | import {ProcessLogLine} from './helpers'; 2 | 3 | /** 4 | * Sends a message to logstash 5 | * Deletes dynamic data 6 | * Returns the result 7 | * @param message 8 | */ 9 | const send = async (message: Object) => { 10 | const rawResponse = await ProcessLogLine(JSON.stringify(message), '5060', 'TCP'); 11 | return JSON.parse(rawResponse); 12 | } 13 | 14 | describe('Generic JSON tests', () => { 15 | it('JSON data should be sent back', async () => { 16 | const data = await send({"type": "generic-json", "key": "value"}); 17 | const { token, key, type } = data; 18 | 19 | expect(token).toEqual('abc1234'); 20 | expect(key).toEqual('value'); 21 | expect(type).toEqual('generic-json'); 22 | }) 23 | }) -------------------------------------------------------------------------------- /logstash/tests/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | import WebSocket from 'ws'; 2 | import axios from 'axios'; 3 | 4 | export async function ProcessLogLine( 5 | logLines: string, 6 | port: string, 7 | protocol: string, 8 | ) { 9 | return new Promise (async (resolve) => { 10 | const ws = await GetBackendConnection(); 11 | 12 | let data; 13 | ws.onmessage = function(evt) { 14 | data = evt.data; 15 | ws.close(); 16 | }; 17 | 18 | ws.onclose = function() { 19 | resolve(data); 20 | } 21 | 22 | await axios.post( 23 | `http://localhost:8080/api/v1/sendLogLines`,{sendString: logLines, port, protocol}, 24 | ); 25 | }); 26 | } 27 | 28 | const GetBackendConnection = async () => { 29 | return new Promise( (resolve) => { 30 | let ws: WebSocket; 31 | try { 32 | ws = new WebSocket('ws://localhost:8080/api/v1/getLogstashOutput'); 33 | } catch (err) { 34 | console.error('Unable to connect to the backend'); 35 | console.log(err); 36 | } 37 | 38 | ws.onopen = function() { 39 | resolve(ws); 40 | }; 41 | }) 42 | } 43 | 44 | -------------------------------------------------------------------------------- /logstash/tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "esModuleInterop": true, 6 | "outDir": "build" 7 | }, 8 | "include": [ 9 | "src/**/*" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /media/logstash pipeline tester.drawio.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /media/pipeline-tester-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/media/pipeline-tester-diagram.png -------------------------------------------------------------------------------- /media/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/media/screenshot.png -------------------------------------------------------------------------------- /pipeline-ui/.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | -------------------------------------------------------------------------------- /pipeline-ui/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:22-alpine3.20 as compile-image 2 | 3 | # npm install frontend 4 | COPY ./frontend/package.json /home/node/app/frontend/package.json 5 | COPY ./frontend/package-lock.json /home/node/app/frontend/package-lock.json 6 | WORKDIR /home/node/app/frontend 7 | RUN npm install --quiet 8 | 9 | # npm install backend 10 | COPY ./backend/package.json /home/node/app/backend/package.json 11 | WORKDIR /home/node/app/backend 12 | RUN npm install --quiet 13 | 14 | # Build frontend 15 | COPY ./frontend/ /home/node/app/frontend 16 | WORKDIR /home/node/app/frontend 17 | RUN npm run build 18 | 19 | # Build backend 20 | COPY ./backend /home/node/app/backend 21 | WORKDIR /home/node/app/backend 22 | RUN npm run build 23 | 24 | # Build app container 25 | FROM node:22-alpine3.20 as runtime-image 26 | WORKDIR /usr/src/app 27 | COPY --from=compile-image /home/node/app/backend/build/ /usr/src/app 28 | COPY --from=compile-image /home/node/app/frontend/build /usr/src/app/public 29 | COPY --from=compile-image /home/node/app/backend/node_modules/ /usr/src/app/node_modules/ 30 | 31 | CMD ["node", "./index.js"] 32 | -------------------------------------------------------------------------------- /pipeline-ui/backend/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'env': { 3 | 'browser': true, 4 | 'commonjs': true, 5 | 'es2021': true, 6 | }, 7 | 'extends': [ 8 | 'google', 9 | ], 10 | 'parser': '@typescript-eslint/parser', 11 | 'parserOptions': { 12 | 'ecmaVersion': 12, 13 | }, 14 | 'plugins': [ 15 | '@typescript-eslint', 16 | ], 17 | 'rules': { 18 | 'require-jsdoc': 0, 19 | 'new-cap': 0, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /pipeline-ui/backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "logtstash-pipeline-tester", 3 | "version": "1.0.0", 4 | "description": "Testing logstash pipelines", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node ./build/index.js", 8 | "dev": "cross-env NODE_ENV=DEV PIPELINE_DIRECTORY=../../logstash/logstash-config/pipeline nodemon ./src/index.ts", 9 | "lint": "eslint ./src/**/*.ts", 10 | "test": "echo \"Error: no test specified\" && exit 1", 11 | "build": "tsc" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git://github.com/epacke/logstash-pipeline-tester.git" 16 | }, 17 | "author": "", 18 | "license": "ISC", 19 | "dependencies": { 20 | "body-parser": "^1.20.3", 21 | "buffer": "^5.7.1", 22 | "cors": "^2.8.5", 23 | "dgram": "^1.0.1", 24 | "express": "^4.21.2", 25 | "express-ws": "^4.0.0", 26 | "http": "0.0.0", 27 | "nodemon": "^3.1.9", 28 | "pino": "^9.5.0", 29 | "pino-http": "^10.4.0", 30 | "pino-pretty": "^13.0.0", 31 | "superagent": "^5.3.1", 32 | "typescript": "^4.9.5" 33 | }, 34 | "devDependencies": { 35 | "@types/cors": "^2.8.17", 36 | "@types/express-ws": "^3.0.0", 37 | "@types/node": "^14.17.3", 38 | "@types/superagent": "^4.1.11", 39 | "@typescript-eslint/eslint-plugin": "^4.26.1", 40 | "@typescript-eslint/parser": "^4.26.1", 41 | "cross-env": "^7.0.3", 42 | "eslint": "^7.28.0", 43 | "eslint-config-google": "^0.14.0", 44 | "ts-node": "^10.9.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/logstashStatus/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | const router = express.Router(); 3 | 4 | // Monitor the logstash container 5 | import {ILogstashAPIResponse, ILogstashStatus} from '../../../interfaces'; 6 | import request from 'superagent'; 7 | import {LOGSTASH} from '../../../constants/LogstashAddress'; 8 | 9 | router.get('/', async function(req, res) { 10 | const responseJson: ILogstashStatus = { 11 | logstashAPI: false, 12 | pipelines: [], 13 | }; 14 | 15 | try { 16 | const logstashResult = await request.get(`http://${LOGSTASH}:9600/_node/pipelines`); 17 | const logstashResponse = logstashResult.body as ILogstashAPIResponse; 18 | responseJson.pipelines = Object.keys(logstashResponse.pipelines); 19 | responseJson.logstashAPI = true; 20 | } catch (e) {} 21 | 22 | res.json(responseJson); 23 | }); 24 | 25 | export default router; 26 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/pipelines/getpipelines.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import fs from 'fs'; 3 | import PIPELINE_DIRECTORY from '../../../constants/PipelineDirectory'; 4 | 5 | export interface IPipeline { 6 | name: string, 7 | protocol?: string, 8 | port?: string 9 | } 10 | 11 | // Return file names from directory 12 | function fromDir(startPath: string, filter: string): string[] { 13 | let foundFiles: string[] = []; 14 | 15 | if (!fs.existsSync(startPath)) { 16 | console.log('Directory did not exist', startPath); 17 | return []; 18 | } 19 | 20 | const files=fs.readdirSync(startPath); 21 | for (let i=0; i=0) { 27 | foundFiles.push(filename); 28 | } 29 | } 30 | 31 | return foundFiles; 32 | } 33 | 34 | 35 | // Get pipeline configs from the pipeline directory 36 | const getConfigFiles = () => { 37 | const configFiles = fromDir(PIPELINE_DIRECTORY, '.conf'); 38 | 39 | const pipeLines: IPipeline[] = []; 40 | for (const configFilePath of configFiles) { 41 | const name = path.dirname(configFilePath) 42 | .split(path.sep).pop() || 'unknown'; 43 | 44 | const configFile = fs.readFileSync(configFilePath, 'utf8'); 45 | 46 | const tcpMatch = configFile 47 | .match(/input {.+?tcp[^[0-9]+(?[0-9]+)/ms) || 48 | {groups: {tcpPort: undefined}}; 49 | const tcpPort = tcpMatch.groups?.tcpPort; 50 | 51 | const udpMatch = configFile 52 | .match(/input {.+?udp[^[0-9]+(?[0-9]+)/ms) || 53 | {groups: {udpPort: undefined}}; 54 | const udpPort = udpMatch.groups?.udpPort; 55 | 56 | if (tcpPort) { 57 | pipeLines.push({name, protocol: 'TCP', port: tcpPort}); 58 | } else if (udpPort) { 59 | pipeLines.push({name, protocol: 'UDP', port: udpPort}); 60 | } 61 | } 62 | 63 | return pipeLines; 64 | }; 65 | 66 | export default getConfigFiles; 67 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/pipelines/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import getPipelines from './getpipelines'; 3 | 4 | const router = express.Router(); 5 | 6 | router.get('/', function(req, res) { 7 | res.json(getPipelines()); 8 | }); 9 | 10 | export default router; 11 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/receiveLogstashOutput/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import {getWss} from '../../../index'; 3 | 4 | const router = express.Router(); 5 | // Receive data from logstash and echo 6 | // it over websocket to all connected clients 7 | router.post('/', function(req, res) { 8 | const body = req.body; 9 | getWss().clients.forEach(function(client) { 10 | client.send(JSON.stringify(body, null, 4)); 11 | }); 12 | res.status(200).end(); 13 | }); 14 | 15 | export default router; 16 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/sendLogLines/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import sendTCP from './sendTCPString'; 3 | import sendUDP from './sendUDPString'; 4 | 5 | const router = express.Router(); 6 | 7 | // Receive lines from the web ui 8 | router.post('/', function(req, res) { 9 | let {sendString, port, protocol} = req.body; 10 | sendString = `${sendString}\n`; 11 | protocol === 'TCP' ? sendTCP(sendString, port) : sendUDP(sendString, port); 12 | res.status(200).end(); 13 | }); 14 | 15 | export default router; 16 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/sendLogLines/sendTCPString.ts: -------------------------------------------------------------------------------- 1 | // Send data to a logstash pipeline using TCP 2 | import net from 'net'; 3 | import {LOGSTASH} from '../../../constants/LogstashAddress'; 4 | import logger from '../../../util/Logger'; 5 | import config from '../../../constants/config'; 6 | 7 | function sendTCP(payload: string, port: number, retries = 0) { 8 | const conn = net.createConnection({host: LOGSTASH, port: port}, function() { 9 | conn.write(payload); 10 | }).on('error', function(err) { 11 | logger.error({ 12 | message: `Failed to send payload to ${port}. ` + 13 | `Has all logstash pipelines started successfully?`, 14 | payload, 15 | details: err.message, 16 | }); 17 | setTimeout(() => { 18 | if (retries > config.maxRetries) { 19 | logger.error({ 20 | message: `Gave up sending payload to ${port}. Timeout reached.`, 21 | payload, 22 | details: err.message, 23 | }); 24 | return; 25 | } 26 | logger.info(`Retrying sending payload to port ${port}`); 27 | sendTCP(payload, port, ++retries); 28 | }, config.retryWaitTimeSeconds * 1000); 29 | }); 30 | } 31 | 32 | export default sendTCP; 33 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/api/v1/sendLogLines/sendUDPString.ts: -------------------------------------------------------------------------------- 1 | // Send data to a logstash pipeline using UDP 2 | import dgram from 'dgram'; 3 | import {LOGSTASH} from '../../../constants/LogstashAddress'; 4 | 5 | function sendUDP(payload: string, port: number) { 6 | const message = new Buffer(payload); 7 | 8 | const client = dgram.createSocket('udp4'); 9 | client.send(message, 0, message.length, port, LOGSTASH, function(err, bytes) { 10 | if (err) throw err; 11 | client.close(); 12 | }); 13 | } 14 | 15 | export default sendUDP; 16 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/constants/LogstashAddress.ts: -------------------------------------------------------------------------------- 1 | export const LOGSTASH = process.env.NODE_ENV === 'DEV' ? 2 | 'localhost' : 'logstash'; 3 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/constants/PipelineDirectory.ts: -------------------------------------------------------------------------------- 1 | export default process.env.PIPELINE_DIRECTORY || 2 | '/usr/src/pipeline'; 3 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/constants/config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | maxRetries: 5, 3 | retryWaitTimeSeconds: 1, 4 | }; 5 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import bodyParser from 'body-parser'; 3 | // @ts-ignore - Problem with the cors typing. 4 | import cors from 'cors'; 5 | import pinoHttp from 'pino-http'; 6 | import expressWs from 'express-ws'; 7 | import logger from './util/Logger'; 8 | import apiV1Pipelines from './api/v1/pipelines/index'; 9 | import apiV1SendLogLines from './api/v1/sendLogLines/index'; 10 | import apiV1ReceiveLogstashOutput from './api/v1/receiveLogstashOutput/index'; 11 | import apiV1LogstashStatus from './api/v1/logstashStatus/index'; 12 | 13 | const dummyApp = express(); 14 | const port = 8080; 15 | 16 | expressWs(dummyApp); 17 | const {app, getWss} = expressWs(express()); 18 | 19 | app.use(cors()); 20 | app.use(bodyParser.json()); 21 | app.use(express.static('public')); 22 | 23 | const httpLogger = pinoHttp({logger}); 24 | app.use(httpLogger); 25 | 26 | // Render the default page when browsing the root 27 | app.get('/', function(req, res) { 28 | res.sendFile('index.html', {root: __dirname + '/public/index.html'} ); 29 | }); 30 | 31 | app.ws('/api/v1/getLogstashOutput', (ws, req) => {}); 32 | app.use('/api/v1/pipelines', apiV1Pipelines); 33 | app.use('/api/v1/sendLogLines', apiV1SendLogLines); 34 | app.use('/api/v1/receiveLogstashOutput', apiV1ReceiveLogstashOutput); 35 | app.use('/api/v1/logstashStatus', apiV1LogstashStatus); 36 | 37 | app.listen(port, 38 | () => logger.info(`Logstash config tester running on port ${port}!`)); 39 | 40 | export {getWss}; 41 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface ILogstashAPIPipeline { 2 | workers: number, 3 | batchSize: number, 4 | batchDelay: number, 5 | configReloadAutomatic: boolean, 6 | configReloadInterval: number, 7 | deadLetterQueueEnabled: boolean, 8 | } 9 | 10 | export interface Pipelines {[key:string]: ILogstashAPIPipeline } 11 | 12 | export interface ILogstashAPIResponse { 13 | host: string, 14 | version: string, 15 | httpAddress: string, 16 | id: string, 17 | name: string, 18 | pipelines: Pipelines, 19 | } 20 | 21 | export interface ILogstashStatus { 22 | logstashAPI: boolean, 23 | pipelines: string[], 24 | } 25 | -------------------------------------------------------------------------------- /pipeline-ui/backend/src/util/Logger.ts: -------------------------------------------------------------------------------- 1 | import pino from 'pino'; 2 | 3 | const logger = pino({ 4 | level: process.env.LOG_LEVEL || 'warn', 5 | }); 6 | 7 | export default logger; 8 | -------------------------------------------------------------------------------- /pipeline-ui/backend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "esModuleInterop": true, 6 | "outDir": "build" 7 | }, 8 | "include": [ 9 | "src/**/*" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/.eslintignore: -------------------------------------------------------------------------------- 1 | src/Assets/Icons/* -------------------------------------------------------------------------------- /pipeline-ui/frontend/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'env': { 3 | 'browser': true, 4 | 'es2021': true, 5 | }, 6 | 'extends': [ 7 | 'plugin:react/recommended', 8 | 'google', 9 | ], 10 | 'parser': '@typescript-eslint/parser', 11 | 'parserOptions': { 12 | 'ecmaFeatures': { 13 | 'jsx': true, 14 | }, 15 | 'ecmaVersion': 12, 16 | 'sourceType': 'module', 17 | }, 18 | 'plugins': [ 19 | 'react', 20 | '@typescript-eslint', 21 | ], 22 | 'rules': { 23 | 'require-jsdoc': 0, 24 | 'new-cap': 0, 25 | 'indent': ['error', 2], 26 | 'padded-blocks': 0, 27 | }, 28 | 'ignorePatterns': ['src/serviceWorker.ts'], 29 | }; 30 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `yarn start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `yarn test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `yarn build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `yarn eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "logstash-pipeline-tester-ui", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.13.5", 7 | "@emotion/styled": "^11.14.0", 8 | "@fontsource/roboto": "^4.5.8", 9 | "@mui/icons-material": "^5.17.1", 10 | "@mui/material": "^5.17.1", 11 | "@mui/styled-engine-sc": "^5.14.10", 12 | "@testing-library/jest-dom": "^4.2.4", 13 | "@testing-library/react": "^14.3.1", 14 | "@testing-library/user-event": "^7.1.2", 15 | "@types/jest": "^24.0.0", 16 | "@types/node": "^12.0.0", 17 | "cross-env": "^7.0.3", 18 | "react": "^18.3.1", 19 | "react-json-pretty": "^2.2.0", 20 | "styled-components": "^5.3.9", 21 | "typescript": "~4.9.4" 22 | }, 23 | "overrides": { 24 | "nth-check": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", 25 | "postcss": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz" 26 | }, 27 | "scripts": { 28 | "start": "cross-env NODE_ENV=production react-scripts start", 29 | "dev": "cross-env NODE_ENV=development react-scripts start", 30 | "lint": "eslint ./src/**/*.ts", 31 | "build": "react-scripts build", 32 | "test": "react-scripts test", 33 | "eject": "react-scripts eject" 34 | }, 35 | "eslintConfig": { 36 | "extends": "react-app" 37 | }, 38 | "browserslist": { 39 | "production": [ 40 | ">0.2%", 41 | "not dead", 42 | "not op_mini all" 43 | ], 44 | "development": [ 45 | "last 1 chrome version", 46 | "last 1 firefox version", 47 | "last 1 safari version" 48 | ] 49 | }, 50 | "devDependencies": { 51 | "@types/react": "^18.3.12", 52 | "@types/react-dom": "^18.3.1", 53 | "@typescript-eslint/eslint-plugin": "^6.7.2", 54 | "@typescript-eslint/parser": "^6.7.2", 55 | "eslint": "^8.49.0", 56 | "eslint-config-google": "^0.14.0", 57 | "eslint-plugin-react": "^7.33.2", 58 | "react-dom": "^18.3.1", 59 | "react-scripts": "^5.0.1" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/apple-touch-icon.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/favicon-16x16.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/favicon-32x32.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/favicon.ico -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 27 | 28 | 37 | Logstash Pipeline Tester 38 | 39 | 40 | 41 |
42 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/logo.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/logo192.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/logo512.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "start_url": ".", 17 | "display": "standalone", 18 | "theme_color": "#000000", 19 | "background_color": "#ffffff" 20 | } 21 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/mstile-144x144.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/mstile-150x150.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/mstile-310x150.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/mstile-310x310.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epacke/logstash-pipeline-tester/02129d84627f55109a4dad1f7ea8777bcad6dddd/pipeline-ui/frontend/public/mstile-70x70.png -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.14, written by Peter Selinger 2001-2017 9 | 10 | 12 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/public/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "short_name": "", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/App.css: -------------------------------------------------------------------------------- 1 | html { 2 | background: rgb(250, 250, 251) 3 | } 4 | 5 | .__json-pretty__ { 6 | border-top: 1px #dee2e6 solid; 7 | border-bottom: 1px #dee2e6 solid; 8 | border-right: 1px #dee2e6 solid; 9 | border-left: 2px #007AC6 solid; 10 | padding: 1em 1em; 11 | line-height: 1.3; 12 | color: #222; 13 | background: #575f6605; 14 | overflow: auto; 15 | } 16 | 17 | .__json-pretty__ .__json-key__ { 18 | color: #ff9940 19 | } 20 | 21 | .__json-pretty__ .__json-value__ { 22 | color: #55b4d4 23 | } 24 | 25 | .__json-pretty__ .__json-string__ { 26 | color: #86b300 27 | } -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {render} from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const {getByText} = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import '@fontsource/roboto/300.css'; 3 | import '@fontsource/roboto/400.css'; 4 | import '@fontsource/roboto/500.css'; 5 | import '@fontsource/roboto/700.css'; 6 | import './App.css'; 7 | import Menu from './Layout/Menu/Menu'; 8 | import {Grid, Paper} from '@mui/material'; 9 | import ConnectBackend from './Util/ConnectBackend'; 10 | import LogstashLogLines from './Components/InputTextarea/LogstashLogLines'; 11 | import {Result} from './Components/Result/Result'; 12 | 13 | function App() { 14 | 15 | const [ 16 | backendConnected, setBackendConnected, 17 | ] = useState(null); 18 | const [logStashResult, setLogstashResult] = useState([]); 19 | const [rawData, setRawData] = useState(''); 20 | const [minifyEnabled, setMinifyEnabled] = useState(false); 21 | 22 | const handleLogStashResult = (message: string) => { 23 | setLogstashResult((prevState) => { 24 | return [...prevState, message]; 25 | }); 26 | }; 27 | 28 | useEffect(() => { 29 | ConnectBackend(setBackendConnected, handleLogStashResult); 30 | }, []); 31 | 32 | const handleMinifyChange = (event: React.ChangeEvent) => { 33 | setMinifyEnabled(event.target.checked); 34 | }; 35 | 36 | return ( 37 | 38 | 39 | 45 | 46 | 47 | 55 | 60 | 61 | 62 | 63 | { 64 | logStashResult.length ? 65 | logStashResult.map((res) => { 66 | return ( 67 | 68 | ); 69 | }) : 70 | '' 71 | } 72 | 73 | 74 | ); 75 | } 76 | 77 | export default App; 78 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Assets/Icons/BackendIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {SvgIcon} from '@mui/material'; 3 | 4 | export default () => { 5 | return 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ; 24 | }; 25 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Assets/Icons/HelpIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {SvgIcon} from '@mui/material'; 3 | 4 | export default () => { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ); 15 | }; 16 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Assets/Icons/LogstashIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {SvgIcon} from '@mui/material'; 3 | 4 | export default () => { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/BackendStatus/BackendStatus.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import BackendIcon from '../../Assets/Icons/BackendIcon'; 3 | import {Badge, Box, Tooltip} from '@mui/material'; 4 | import {CheckCircle} from '@mui/icons-material'; 5 | import ErrorIcon from '@mui/icons-material/Error'; 6 | import {BackendStatusHelp} from '../HelpPopups/HelpPopups'; 7 | 8 | interface IBackendState { 9 | backendConnected: boolean | null, 10 | } 11 | 12 | const BackendState = (props: IBackendState) => { 13 | 14 | const [helpOpen, setHelpOpen] = useState(false); 15 | const {backendConnected} = props; 16 | const [icon, setIcon] = useState(); 17 | 18 | useEffect(() => { 19 | if (backendConnected === null) return; 20 | setIcon(backendConnected ? 21 | : 22 | ); 23 | }, [backendConnected]); 24 | 25 | const handleBackendStatusClick = () => { 26 | setHelpOpen(true); 27 | }; 28 | 29 | return ( 30 | <> 31 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ); 46 | }; 47 | 48 | export default BackendState; 49 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/GeneralHelp/GeneralHelp.tsx: -------------------------------------------------------------------------------- 1 | import React, {useState} from 'react'; 2 | import {Box, Tooltip} from '@mui/material'; 3 | import {GeneralHelp} from '../HelpPopups/HelpPopups'; 4 | import HelpIcon from '../../Assets/Icons/HelpIcon'; 5 | 6 | const BackendState = () => { 7 | 8 | const [helpOpen, setHelpOpen] = useState(false); 9 | 10 | const handleHelpClick = () => { 11 | setHelpOpen(true); 12 | }; 13 | 14 | return ( 15 | <> 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ); 24 | }; 25 | 26 | export default BackendState; 27 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/HelpPopups/HelpPopups.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import Button from '@mui/material/Button'; 3 | import Dialog from '@mui/material/Dialog'; 4 | import DialogActions from '@mui/material/DialogActions'; 5 | import DialogContent from '@mui/material/DialogContent'; 6 | import Link from '@mui/material/Link'; 7 | import DialogContentText from '@mui/material/DialogContentText'; 8 | import DialogTitle from '@mui/material/DialogTitle'; 9 | import {Backend} from '../../Util/Backend'; 10 | 11 | const HelpPopup = function( 12 | props: { 13 | content: JSX.Element, 14 | open: boolean, 15 | setOpen: (open: boolean) => void 16 | }) { 17 | 18 | const {content, open, setOpen} = props; 19 | 20 | const handleClose = () => { 21 | setOpen(false); 22 | }; 23 | 24 | return ( 25 |
26 | 32 | {content} 33 | 38 | 39 | 40 | 41 |
42 | ); 43 | }; 44 | 45 | const LogstashStatusHelp = ( 46 | props: { 47 | open: boolean, 48 | setOpen: (open: boolean) => void}, 49 | ) => { 50 | const {open, setOpen} = props; 51 | const content = <> 52 | 58 | {'About Logstash Status'} 59 | 60 | 61 | 62 | Logstash should be running in the background as a container. 63 | The frontend and backend expects it to be reachable on port 9600. 64 |
65 | The error icon will show if the frontend application is unable to 66 | connect to logstash. Have a look at the docker logs to ensure 67 | that logstash is running. 68 |
69 |
70 | ; 71 | 72 | return ( 73 | 74 | ); 75 | }; 76 | 77 | const BackendStatusHelp = ( 78 | props: { 79 | open: boolean, 80 | setOpen: (open: boolean) => void}, 81 | ) => { 82 | const {open, setOpen} = props; 83 | const content = <> 84 | 90 | {'About Backend Status'} 91 | 92 | 93 | 94 | The backend process is running in the container and the 95 | frontend Web UI is trying to reach it via {Backend}. 96 |
97 | If it is unable to you'll see an error. 98 | Check the docker container and validate that the 99 | backend process is still running. 100 |
101 |
102 | ; 103 | 104 | return ( 105 | 106 | ); 107 | }; 108 | 109 | const GeneralHelp = ( 110 | props: { 111 | open: boolean, 112 | setOpen: (open: boolean) => void}, 113 | ) => { 114 | const {open, setOpen} = props; 115 | const content = <> 116 | 122 | {'About this tool'} 123 | 124 | 125 | 126 | It‘s pretty easy. Pick protocol, enter port and then submit 127 | your log lines to the logstash backend. 128 |
129 | If you need further assistance or guidance on how to 130 | use this tool, please check either 132 | the manual 133 | 134 | , or the projects 138 | GitHub page 139 | . 140 |

141 | If you have found a bug or issue, please 143 | report it here 144 | . 145 |
146 |
147 | ; 148 | 149 | return ( 150 | 151 | ); 152 | }; 153 | 154 | export {LogstashStatusHelp, BackendStatusHelp, GeneralHelp}; 155 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/InputPort/InputPort.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import {SyntheticEvent, useEffect} from 'react'; 3 | import {TextField} from '@mui/material'; 4 | import ValidatePortInput from '../../Util/ValidatePortInput'; 5 | 6 | interface IInputPortProps { 7 | error: boolean, 8 | setError: (state: boolean) => void, 9 | port: string, 10 | setPort: (port: string) => void, 11 | } 12 | 13 | export default function InputPort(props: IInputPortProps) { 14 | 15 | const {port, setPort, error, setError} = props; 16 | 17 | useEffect(() => { 18 | setError(!ValidatePortInput(port) && port !== ''); 19 | }, [port]); 20 | 21 | const handleChange = (event: SyntheticEvent) => { 22 | const {value} = event.target as HTMLInputElement; 23 | const validPort = ValidatePortInput(value) || value === ''; 24 | setError(!validPort); 25 | setPort(value); 26 | }; 27 | 28 | return ( 29 | 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/InputTextarea/LogstashLogLines.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { 3 | useRef, 4 | MutableRefObject, 5 | useEffect, 6 | useState, 7 | } from 'react'; 8 | import {TextField} from '@mui/material'; 9 | 10 | export default function LogstashLogLines( 11 | props: { 12 | setRawData: (rawData: string) => void, 13 | rawData: string, 14 | minifyEnabled: boolean, 15 | }, 16 | ) { 17 | 18 | const {setRawData, rawData, minifyEnabled} = props; 19 | const [rowCount, setRowCount] = useState(1); 20 | const [helperText, setHelperText] = useState(<>); 21 | const [validJson, setValidJson] = useState(false); 22 | const logInput = useRef() as MutableRefObject; 23 | 24 | useEffect(() => { 25 | handleRawDataChange(); 26 | }, [minifyEnabled, rowCount]); 27 | 28 | useEffect(() => { 29 | const jsonState = minifyEnabled && !validJson ? 30 | 32 |  Can't minify: Invalid JSON 33 | : 34 | null; 35 | setHelperText( 36 | <> 37 | 38 | { 39 | `Will send ${rowCount} document${ 40 | rowCount == 1 ? '': 's' 41 | }` 42 | } 43 | 44 | {jsonState} 45 | , 46 | ); 47 | }, [rowCount, rawData, minifyEnabled]); 48 | 49 | useEffect(() => { 50 | handleRawDataChange(); 51 | }, [minifyEnabled]); 52 | 53 | const minifyJson = (rawString: string) => { 54 | let result = rawString; 55 | try { 56 | result = JSON.stringify(JSON.parse(rawString)); 57 | setValidJson(true); 58 | } catch { 59 | setValidJson(false); 60 | } 61 | return result; 62 | }; 63 | 64 | const handleRawDataChange = () => { 65 | const {value} = logInput.current; 66 | if (minifyEnabled) { 67 | logInput.current.value = minifyJson(value); 68 | } 69 | setRowCount(value.split(/\r\n|\r|\n/).length); 70 | setRawData(value); 71 | }; 72 | 73 | return ( 74 | 88 | ); 89 | } 90 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/LogstashStatus/LogstashStatus.tsx: -------------------------------------------------------------------------------- 1 | import React, {useState, useEffect} from 'react'; 2 | import {Backend} from '../../Util/Backend'; 3 | import LogstashIcon from '../../Assets/Icons/LogstashIcon'; 4 | import {Badge, Box, Tooltip} from '@mui/material'; 5 | import {CheckCircle} from '@mui/icons-material'; 6 | import ErrorIcon from '@mui/icons-material/Error'; 7 | import {LogstashStatusHelp} from '../HelpPopups/HelpPopups'; 8 | 9 | const LogStashState = () => { 10 | 11 | const [connected, setConnected] = useState(null); 12 | const [icon, setIcon] = useState(); 13 | const [helpOpen, setHelpOpen] = useState(false); 14 | 15 | useEffect(() => { 16 | setIcon(connected ? 17 | : 18 | ); 19 | }, [connected]); 20 | 21 | const handleLogstashStatusClick = () => { 22 | setHelpOpen(true); 23 | }; 24 | 25 | useEffect(() => { 26 | const logstashStateInterval = setInterval(() => { 27 | getLogstashState(setConnected); 28 | }, 2000); 29 | return () => { 30 | clearInterval(logstashStateInterval); 31 | }; 32 | }, []); 33 | 34 | return ( 35 | <> 36 | 37 | 38 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | ); 50 | }; 51 | 52 | const getLogstashState = async ( 53 | setLogStashConnected: (status: boolean) => void) => { 54 | try { 55 | const res = await fetch(`${Backend}/api/v1/logstashStatus`); 56 | const logstashStatus = await res.json(); 57 | 58 | if (!logstashStatus.logstashAPI) { 59 | setLogStashConnected(false); 60 | } else { 61 | setLogStashConnected(true); 62 | } 63 | } catch (e) { 64 | setLogStashConnected(false); 65 | } 66 | }; 67 | 68 | export default LogStashState; 69 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/Result/Result.tsx: -------------------------------------------------------------------------------- 1 | import {Box, Button, Paper} from '@mui/material'; 2 | import JSONPretty from 'react-json-pretty'; 3 | import React, {useState, useRef, MutableRefObject} from 'react'; 4 | import {ContentCopy} from '@mui/icons-material'; 5 | 6 | const Result = (props: {result: string}) => { 7 | 8 | const [showCopy, setShowCopy] = useState(false); 9 | const {result} = props; 10 | const copyButton = useRef() as MutableRefObject; 11 | 12 | const handleCopy = () => { 13 | navigator.clipboard.writeText(result); 14 | }; 15 | 16 | return ( 17 | { 20 | setShowCopy(true); 21 | }} 22 | onMouseLeave={() => { 23 | setShowCopy(false); 24 | }} 25 | data-cy='logstash-result-container' 26 | > 27 | 37 | 54 | 58 | 63 | 64 | 65 | ); 66 | }; 67 | 68 | export {Result}; 69 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/SelectPipeline/SelectPipeline.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import MenuItem from '@mui/material/MenuItem'; 3 | import FormControl from '@mui/material/FormControl'; 4 | import {Backend} from '../../Util/Backend'; 5 | import {IPipeline} from '../../Interfaces/CommonInterfaces'; 6 | import {useEffect, useState} from 'react'; 7 | import Select, {SelectChangeEvent} from '@mui/material/Select'; 8 | 9 | interface IPipelineProps { 10 | setPipeline: (pipeline: IPipeline | null) => void, 11 | } 12 | 13 | export default function BasicSelect(props: IPipelineProps) { 14 | const {setPipeline} = props; 15 | const [pipelines, setPipelines] = useState([]); 16 | const [selectedValue, setSelectedValue] = useState(''); 17 | 18 | const handleChange = (event: SelectChangeEvent) => { 19 | const {value} = event.target; 20 | const s = pipelines.find((p) => p.name == value) || null; 21 | setSelectedValue(value); 22 | setPipeline(s); 23 | }; 24 | 25 | useEffect(() => { 26 | preparePipelines().then((p) => { 27 | setPipelines(p); 28 | }); 29 | }, []); 30 | 31 | return ( 32 | 33 | 51 | 52 | ); 53 | } 54 | 55 | async function preparePipelines(): Promise { 56 | const res = await fetch(`${Backend}/api/v1/pipelines`); 57 | return await res.json() as IPipeline[]; 58 | } 59 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/SelectProtocol/SelectProtocol.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import MenuItem from '@mui/material/MenuItem'; 3 | import FormControl from '@mui/material/FormControl'; 4 | import Select, {SelectChangeEvent} from '@mui/material/Select'; 5 | 6 | interface ISelectProtocolProps { 7 | protocol: string, 8 | setProtocol: (protocol: string) => void, 9 | } 10 | 11 | export default function SelectProtocol(props: ISelectProtocolProps) { 12 | 13 | const {protocol, setProtocol} = props; 14 | 15 | const handleChange = (event: SelectChangeEvent) => { 16 | const {value} = event.target; 17 | setProtocol(value); 18 | }; 19 | 20 | return ( 21 | 22 | 33 | 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Components/ToggleMinify/ToggleMinify.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import FormControlLabel from '@mui/material/FormControlLabel'; 3 | import Switch from '@mui/material/Switch'; 4 | import {Tooltip} from '@mui/material'; 5 | 6 | export default function ToggleMinify( 7 | props: { 8 | handleMinifyChange: (event: React.ChangeEvent) => void }, 9 | ) { 10 | 11 | const {handleMinifyChange} = props; 12 | 13 | return ( 14 | 18 | } 20 | label="Minify input JSON" 21 | /> 22 | 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Interfaces/CommonInterfaces.ts: -------------------------------------------------------------------------------- 1 | export interface IPipeline { 2 | name: string, 3 | protocol: string, 4 | port: string, 5 | } 6 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Layout/Menu/Menu.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import AppBar from '@mui/material/AppBar'; 3 | import Toolbar from '@mui/material/Toolbar'; 4 | import Container from '@mui/material/Container'; 5 | import SelectPipeline from '../../Components/SelectPipeline/SelectPipeline'; 6 | import {IPipeline} from '../../Interfaces/CommonInterfaces'; 7 | import {Box, Button} from '@mui/material'; 8 | import LogstashStatus from '../../Components/LogstashStatus/LogstashStatus'; 9 | import BackendStatus from '../../Components/BackendStatus/BackendStatus'; 10 | import HelpButton from '../../Components/GeneralHelp/GeneralHelp'; 11 | import SelectProtocol from '../../Components/SelectProtocol/SelectProtocol'; 12 | import InputPort from '../../Components/InputPort/InputPort'; 13 | import SendIcon from '@mui/icons-material/Send'; 14 | import FormControl from '@mui/material/FormControl'; 15 | import {useEffect, useState} from 'react'; 16 | import {Backend} from '../../Util/Backend'; 17 | import ValidatePortInput from '../../Util/ValidatePortInput'; 18 | import ToggleMinify from '../../Components/ToggleMinify/ToggleMinify'; 19 | 20 | function ResponsiveAppBar(props: { 21 | rawData: string, 22 | backendConnected: boolean | null, 23 | setLogstashResult: (result: string[]) => void, 24 | handleMinifyChange: (event: React.ChangeEvent) => void, 25 | }) { 26 | 27 | const { 28 | setLogstashResult, 29 | rawData, 30 | backendConnected, 31 | handleMinifyChange, 32 | } = props; 33 | 34 | const [pipeline, setPipeline] = useState(null); 35 | const [port, setPort] = useState(''); 36 | const [protocol, setProtocol] = useState('TCP'); 37 | const [portError, setPortError] = useState(false); 38 | 39 | useEffect(() => { 40 | if (!pipeline) { 41 | return; 42 | } 43 | const {port, protocol} = pipeline; 44 | setPort(port); 45 | setProtocol(protocol); 46 | }, [pipeline]); 47 | 48 | const handleSubmit = () => { 49 | if (!ValidatePortInput(port)) { 50 | setPortError(true); 51 | return; 52 | } 53 | setLogstashResult([]); 54 | fetch( 55 | `${Backend}/api/v1/sendLogLines`, { 56 | 'method': 'POST', 57 | 'headers': { 58 | 'Content-Type': 'application/json', 59 | }, 60 | 'body': JSON.stringify( 61 | {sendString: rawData, port: port, protocol: protocol}, 62 | ), 63 | }, 64 | ); 65 | }; 66 | 67 | return ( 68 | <> 69 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 95 | 96 | 100 | 101 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | ); 129 | } 130 | 131 | export default ResponsiveAppBar; 132 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Util/Backend.ts: -------------------------------------------------------------------------------- 1 | const {protocol, host} = window.location; 2 | const wsProtocol = protocol === 'https:' ? 'wss': 'ws'; 3 | 4 | const {NODE_ENV} = process.env; 5 | const backendHost = NODE_ENV === 'development' ? 'localhost:8080': host; 6 | const webSocketsBackend = `${wsProtocol}://${backendHost}`; 7 | const Backend = `${protocol}//${backendHost}`; 8 | 9 | export {Backend, webSocketsBackend}; 10 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Util/ConnectBackend.ts: -------------------------------------------------------------------------------- 1 | import {webSocketsBackend} from './Backend'; 2 | 3 | const BackendConnection = async (setBackendConnected: (status: boolean) => void, 4 | handleLogStashResult: (messages: string) => void) => { 5 | let ws: WebSocket; 6 | try { 7 | ws = await new WebSocket(`${webSocketsBackend}/api/v1/getLogstashOutput`); 8 | } catch (err) { 9 | console.error('Unable to connect to the backend'); 10 | throw new Error('Unable to connect to the backend'); 11 | } 12 | 13 | ws.onopen = function() { 14 | setBackendConnected(true); 15 | }; 16 | 17 | ws.onmessage = function(evt) { 18 | handleLogStashResult(evt.data); 19 | }; 20 | 21 | ws.onerror = function(err) { 22 | console.error('Socket encountered error: ', err, 'Closing socket'); 23 | ws.close(); 24 | }; 25 | 26 | ws.onclose = function() { 27 | setBackendConnected(false); 28 | const t = setInterval(async () => { 29 | try { 30 | await BackendConnection(setBackendConnected, handleLogStashResult); 31 | clearInterval(t); 32 | } catch (e) { 33 | console.error('Reconnect failed'); 34 | throw new Error('Reconnect failed'); 35 | } 36 | }, 1000); 37 | }; 38 | }; 39 | 40 | export default BackendConnection; 41 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/Util/ValidatePortInput.ts: -------------------------------------------------------------------------------- 1 | export default (port: string) => { 2 | return /^[0-9]+$/.test(port); 3 | }; 4 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {createRoot} from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | 6 | const root = createRoot(document.getElementById('root')!); 7 | root.render(); 8 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/pipeline-ui.css: -------------------------------------------------------------------------------- 1 | table.table td:first-child { 2 | width:100%; 3 | } 4 | 5 | table textarea#send-string { 6 | width:100%; 7 | } 8 | 9 | input#send-port { 10 | min-width:40px; 11 | } 12 | 13 | select#pipeline-select { 14 | max-width: 300px; 15 | } 16 | 17 | .__json-pretty__ { 18 | border-top: 1px #dee2e6 solid; 19 | border-bottom: 1px #dee2e6 solid; 20 | border-right: 1px #dee2e6 solid; 21 | border-left: 2px #007AC6 solid; 22 | padding: 1em 1em; 23 | line-height: 1.3; 24 | color: #222; 25 | background: #575f6605; 26 | overflow: auto; 27 | } 28 | 29 | .__json-pretty__ .__json-key__ { 30 | color: #ff9940 31 | } 32 | 33 | .__json-pretty__ .__json-value__ { 34 | color: #55b4d4 35 | } 36 | 37 | .__json-pretty__ .__json-string__ { 38 | color: #86b300 39 | } 40 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | // 2 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/serviceWorker.ts: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | type Config = { 24 | onSuccess?: (registration: ServiceWorkerRegistration) => void; 25 | onUpdate?: (registration: ServiceWorkerRegistration) => void; 26 | }; 27 | 28 | export function register(config?: Config) { 29 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 30 | // The URL constructor is available in all browsers that support SW. 31 | const publicUrl = new URL( 32 | process.env.PUBLIC_URL || '', 33 | window.location.href 34 | ); 35 | if (publicUrl.origin !== window.location.origin) { 36 | // Our service worker won't work if PUBLIC_URL is on a different origin 37 | // from what our page is served on. This might happen if a CDN is used to 38 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 39 | return; 40 | } 41 | 42 | window.addEventListener('load', () => { 43 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 44 | 45 | if (isLocalhost) { 46 | // This is running on localhost. Let's check if a service worker still exists or not. 47 | checkValidServiceWorker(swUrl, config); 48 | 49 | // Add some additional logging to localhost, pointing developers to the 50 | // service worker/PWA documentation. 51 | navigator.serviceWorker.ready.then(() => { 52 | console.log( 53 | 'This web app is being served cache-first by a service ' + 54 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 55 | ); 56 | }); 57 | } else { 58 | // Is not localhost. Just register service worker 59 | registerValidSW(swUrl, config); 60 | } 61 | }); 62 | } 63 | } 64 | 65 | function registerValidSW(swUrl: string, config?: Config) { 66 | navigator.serviceWorker 67 | .register(swUrl) 68 | .then(registration => { 69 | registration.onupdatefound = () => { 70 | const installingWorker = registration.installing; 71 | if (installingWorker == null) { 72 | return; 73 | } 74 | installingWorker.onstatechange = () => { 75 | if (installingWorker.state === 'installed') { 76 | if (navigator.serviceWorker.controller) { 77 | // At this point, the updated precached content has been fetched, 78 | // but the previous service worker will still serve the older 79 | // content until all client tabs are closed. 80 | console.log( 81 | 'New content is available and will be used when all ' + 82 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 83 | ); 84 | 85 | // Execute callback 86 | if (config && config.onUpdate) { 87 | config.onUpdate(registration); 88 | } 89 | } else { 90 | // At this point, everything has been precached. 91 | // It's the perfect time to display a 92 | // "Content is cached for offline use." message. 93 | console.log('Content is cached for offline use.'); 94 | 95 | // Execute callback 96 | if (config && config.onSuccess) { 97 | config.onSuccess(registration); 98 | } 99 | } 100 | } 101 | }; 102 | }; 103 | }) 104 | .catch(error => { 105 | console.error('Error during service worker registration:', error); 106 | }); 107 | } 108 | 109 | function checkValidServiceWorker(swUrl: string, config?: Config) { 110 | // Check if the service worker can be found. If it can't reload the page. 111 | fetch(swUrl, { 112 | headers: { 'Service-Worker': 'script' } 113 | }) 114 | .then(response => { 115 | // Ensure service worker exists, and that we really are getting a JS file. 116 | const contentType = response.headers.get('content-type'); 117 | if ( 118 | response.status === 404 || 119 | (contentType != null && contentType.indexOf('javascript') === -1) 120 | ) { 121 | // No service worker found. Probably a different app. Reload the page. 122 | navigator.serviceWorker.ready.then(registration => { 123 | registration.unregister().then(() => { 124 | window.location.reload(); 125 | }); 126 | }); 127 | } else { 128 | // Service worker found. Proceed as normal. 129 | registerValidSW(swUrl, config); 130 | } 131 | }) 132 | .catch(() => { 133 | console.log( 134 | 'No internet connection found. App is running in offline mode.' 135 | ); 136 | }); 137 | } 138 | 139 | export function unregister() { 140 | if ('serviceWorker' in navigator) { 141 | navigator.serviceWorker.ready 142 | .then(registration => { 143 | registration.unregister(); 144 | }) 145 | .catch(error => { 146 | console.error(error.message); 147 | }); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /pipeline-ui/frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react", 21 | "noFallthroughCasesInSwitch": true 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('cypress') 2 | 3 | module.exports = defineConfig({ 4 | video: false, 5 | screenshotOnRunFailure: false, 6 | viewportWidth: 1280, 7 | viewportHeight: 720, 8 | chromeWebSecurity: false, 9 | e2e: { 10 | // We've imported your old cypress plugins here. 11 | // You may want to clean this up later by importing these. 12 | setupNodeEvents(on, config) { 13 | return require('./cypress/plugins/index.js')(on, config) 14 | }, 15 | }, 16 | }) 17 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/cypress/e2e/integration-test.cy.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | context('Waiting', () => { 4 | 5 | beforeEach(() => { 6 | cy.visit('http://localhost:8080/'); 7 | }) 8 | 9 | describe('Interface tests', () => { 10 | 11 | it('Loads the interface', () => { 12 | cy.title().should('eq', 'Logstash Pipeline Tester'); 13 | }) 14 | 15 | it('Should connect to backend', () => { 16 | cy.get('[data-cy=backend-status-badge] span.MuiBadge-badge svg', {timeout: 4000}) 17 | .should('have.class', 'MuiSvgIcon-colorSuccess'); 18 | }) 19 | 20 | it('Should connect to logstash', () => { 21 | cy.get('[data-cy=logstash-status-badge] span.MuiBadge-badge svg', {timeout: 4000}) 22 | .should('have.class', 'MuiSvgIcon-colorSuccess'); 23 | }) 24 | 25 | it('Should pre-select port and protocol automatically', () => { 26 | cy.get('[data-cy="pipeline-select"]').click(); 27 | cy.get('[data-cy="pipeline-menu-item-generic-json"').click(); 28 | cy.get('[data-cy="send-port"] input').should('have.value', '5060'); 29 | }) 30 | 31 | it('Should get a json reply when sending valid json to generic-json', () => { 32 | cy.get('[data-cy="pipeline-select"]').click(); 33 | cy.get('[data-cy="pipeline-menu-item-generic-json"').click(); 34 | cy.get('[data-cy="raw-logs-input"] textarea').first() 35 | .type('{"test": 123}', {parseSpecialCharSequences: false}); 36 | cy.get('[data-cy="send-raw-logs"]').click({force: true}); 37 | cy.get( 38 | '[data-cy="logstash-result"] pre', {timeout: 60000}) 39 | .should('contain.text', '"test": 123', ); 40 | }) 41 | 42 | it('Should be able to view copy button', () => { 43 | cy.get('[data-cy="pipeline-select"]').click(); 44 | cy.get('[data-cy="pipeline-menu-item-generic-json"').click(); 45 | cy.get('[data-cy="raw-logs-input"] textarea').first() 46 | .type('{"test": 123}', {parseSpecialCharSequences: false}); 47 | cy.get('[data-cy="send-raw-logs"]').click(); 48 | cy.get( 49 | '[data-cy="logstash-result"] pre', {timeout: 60000}) 50 | .should('contain.text', '"test": 123', ); 51 | cy.get('[data-cy="logstash-result-container"] [data-cy="copy-result-button').should('be.hidden'); 52 | cy.get('[data-cy="logstash-result-container"]').trigger('mouseover'); 53 | cy.get('[data-cy="logstash-result-container"] [data-cy="copy-result-button').should('be.visible'); 54 | }) 55 | 56 | 57 | }) 58 | }) 59 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/cypress/plugins/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | // *********************************************************** 3 | // This example plugins/index.js can be used to load plugins 4 | // 5 | // You can change the location of this file or turn off loading 6 | // the plugins file with the 'pluginsFile' configuration option. 7 | // 8 | // You can read more here: 9 | // https://on.cypress.io/plugins-guide 10 | // *********************************************************** 11 | 12 | // This function is called when a project is opened or re-opened (e.g. due to 13 | // the project's config changing) 14 | 15 | /** 16 | * @type {Cypress.PluginConfig} 17 | */ 18 | // eslint-disable-next-line no-unused-vars 19 | module.exports = (on, config) => { 20 | // `on` is used to hook into various events Cypress emits 21 | // `config` is the resolved Cypress config 22 | } 23 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add('login', (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This will overwrite an existing command -- 25 | // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /pipeline-ui/integration-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "integration-tests", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "cypress run", 8 | "start:dev": "cypress run --headed --no-exit", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "cypress": "^13.1.0" 15 | } 16 | } 17 | --------------------------------------------------------------------------------